# Rating scale (that is both continuous and categorical at the same time)

**URL:** <https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530>\
**Category:** Builder\
**Created:** [February 25, 2023, 6:34pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530 "2023-02-25T18:34:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gshejaeya](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gshejaeya/32/33794_2.png) [@gshejaeya](https://discourse.psychopy.org/u/gshejaeya)\
**Post date:** [February 25, 2023, 6:34pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/1 "2023-02-25T18:34:34Z")

</div>

Hi,  
I’m working on a speech perception study in which participants will hear a sound and they have to rate it as being: [X sound, sounds more like X, Y sound, sounds more like Y, or a totally different sound].

I thought of using a scale in which participants:

- can click on the ends only if they think the sound is perfect X or perfect Y (categorical).
- Or press anywhere on the line between X and Y to indicate that the sound is more like X or more like Y (continuous), where I can see how close it is to one end based on where the participant located the point on the line.
- Or if the sound is different from both X and Y to be able to click on another option on the same screen that says “other sound”.  
Can I do that in Psychopy?  
Thank you,  
Ghada

---

<div class="post-metadata">

**Author:** ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)\
**Post date:** [February 25, 2023, 11:03pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/2 "2023-02-25T23:03:34Z")

</div>

Hey,  
Yes, PsychoPy is perfect for what you are describing.  
You can create two sliders, one categorical and one continuous. Then, depending on a condition, show one or the other.

I created an example with 12 loops, six loops with condition 1, and 6 loops with condition 2.  
I also added two sliders, one categorical and one continuous.  
Each one of the conditions has three categorical and three continuous sliders:

| Condtion\_Type | Slider\_Type |
| --- | --- |
| 1 | 0 |
| 1 | 0 |
| 1 | 0 |
| 1 | 1 |
| 1 | 1 |
| 1 | 1 |
| 2 | 0 |
| 2 | 0 |
| 2 | 0 |
| 2 | 1 |
| 2 | 1 |
| 2 | 1 |

Depending on the structure of your conditions, you might only use one condition, which is `Slider_Type`. You can change the conditions however fits your experiment.

Here’s an experiment example you can download and view:  
[Slider.zip](https://discourse.psychopy.org/uploads/short-url/5CaWxDr73p6vUS8AfbSyHcmddS1.zip) (90.7 KB)

---

<div class="post-metadata">

**Author:** ![gshejaeya](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gshejaeya/32/33794_2.png) [@gshejaeya](https://discourse.psychopy.org/u/gshejaeya)\
**Post date:** [February 26, 2023, 7:12pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/3 "2023-02-26T19:12:44Z")

</div>

Thank you so much.  
I wonder if we can label the rating scale with images instead of words for the ticks. Can we do that?

---

<div class="post-metadata">

**Author:** ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)\
**Post date:** [February 26, 2023, 7:42pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/4 "2023-02-26T19:42:22Z")

</div>

According to the docs, labels are being created as a text box. Inserting images won’t work.  
I tried testing it, and if you try to insert images as your labels, you get a string declaring the class of the image.

```python
# Make labels
        self.labelObjs = []
        if self.labels is not None:
            self._getLabelParams()
            for n, label in enumerate(self.labels):
                # Skip blank labels
                if label is None:
                    continue
                # Create textbox for each label
                obj = TextBox2(
                    self.win, label, font=self.font,
                    pos=self.labelParams['pos'][n], size=self.labelParams['size'][n], padding=self.labelParams['padding'][n], units=self.units,
                    anchor=self.labelParams['anchor'][n], alignment=self.labelParams['alignment'][n],
                    color=self._foreColor.copy(), fillColor=None, colorSpace=self.colorSpace,
                    borderColor="red" if debug else None,
                    letterHeight=self.labelHeight,
                    autoLog=False
                )
                self.labelObjs.append(obj)

```

You can try to find the positions of the labels and place images under the ticks. I don’t see a better solution…

---

<div class="post-metadata">

**Author:** ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)\
**Post date:** [February 26, 2023, 8:10pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/5 "2023-02-26T20:10:05Z")

</div>

If you have the knowledge and the time, you can try to change the code I showed you in the comment above (in the developer version).

Instead of assigning the label with a text box, assign it with anything (maybe not anything, but you get my point):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/e/0/e0f51509b79e3550a14f35dbc4711ab7fd461097.png)

I wouldn’t change it unless you know it won’t create any bugs in your experiments. For example, if you know that images as labels are the only scenario you will use for the slider’s labels.

I created two images in my experiments, `image` and `image_2`.  
Then all I had to do so set those images as the attributes of the labels and it works:

```python
# Begin Routine:
slider = visual.Slider(win, ticks=(1, 2, 3, 4, 5), labels=(image, image_2))

```

And it looks like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/6/f/6f338d57b6a84f3377cc6e277b52244fad63370b.png)

---

<div class="post-metadata">

**Author:** ![gshejaeya](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gshejaeya/32/33794_2.png) [@gshejaeya](https://discourse.psychopy.org/u/gshejaeya)\
**Post date:** [February 26, 2023, 8:44pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/6 "2023-02-26T20:44:10Z")

</div>

The issue is that I need to have the instructions in Arabic, not in English. The instructions appear in Arabic without a problem but the ticks’ labels on the scale show weird symbols when I type in Arabic. So, I thought that I can use images created in Paint with Arabic text on them.

---

<div class="post-metadata">

**Author:** ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)\
**Post date:** [February 26, 2023, 9:13pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/7 "2023-02-26T21:13:15Z")

</div>

I am not exactly sure why. I think it has something to do with the font. Note that it sometimes worked and sometimes didn’t work on my machine, so make sure you check it a couple of times before declaring it a viable solution.

```python
# Begin Routine:
slider = visual.Slider(win,labels=("السلام عليكم", "السلام عليكم", "السلام عليكم"), font="Arial")

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/c/f/cf408e8bc79c9a9e8320869412fd480cab634b8c.png)

---

<div class="post-metadata">

**Author:** ![gshejaeya](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gshejaeya/32/33794_2.png) [@gshejaeya](https://discourse.psychopy.org/u/gshejaeya)\
**Post date:** [February 27, 2023, 1:32am UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/8 "2023-02-27T01:32:32Z")

</div>

In the instructions at the top of the screen, the words in Arabic were correct. I managed to do that by choosing ‘Arabic’ as the language style in the Formatting tab of the text added. However, I didn’t know how to do that for the ticks’ labels on the slider.  
In the first option, I tried to reverse the letters of the words, but the result was that the order of the letters was correct but they were not connected as they should be in Arabic words.  
Also, as you can see in the second image, the markers on the slider are shifted out of the circles. What should I do to position them at the center of the circle?  
I used the following code in ‘Begin Routine’:  
slider = visual.Slider(win,flip=False,style= ‘radio’,size=(0.1,0.55), pos=(0.7,-0.06),labels=(“السلام عليكم”, “السلام عليكم”, “مالسلا”), font=“Arial”)

 ![Screenshot (169)](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/d/4/d49da6b37000a4183e00d8d182be791b38dde16f.png)  
 ![Screenshot (171)](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/2/f/2fa2429e41dc0f67808aff0ff389adeef6a13679.png)

---

<div class="post-metadata">

**Author:** ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)\
**Post date:** [February 27, 2023, 3:23pm UTC](https://discourse.psychopy.org/t/rating-scale-that-is-both-continuous-and-categorical-at-the-same-time/33530/9 "2023-02-27T15:23:58Z")

</div>

Are the labels okay now with the fix I sent, or it doesn’t work as intended? I got a little confused.  
Are you saying that right now, the text of the label is backward?  
You can place text instead of labels, it’s a pain to position, but it will work. Using Arabic is problematic without the language style.

Try to check this question about slider labels:

> [@Slider labels are not aligned correctly Online](https://discourse.psychopy.org/t/slider-labels-are-not-aligned-correctly-online/20397):
>
> I want to report a little bug in the slider component. I noticed that the slider labels are not aligned with their ticks online (see the figure below). Interestingly, this only happens when the slider is shown after the first time. And if I exit the full screen mode, the labels get aligned properly (see the figure below). Right now, I use arrows to indicate that the labels should indicate the two ends. (Search unicode arrows) But it’s not ideal. And I don’t want…

You can find many more questions referring to the same issue. Try to search there first; the solution is probably there 🙂
