Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sortring in descending order in scatterplots

    Hi all,

    I am trying to build a two-way scatterplot having on the y axis values of a variable called own sorted in descending order and on the x axis values of a corresponding variable called mean price. Now the point is that on the x axis I would like data not to have a specific order. They have indeed to follow the descending order of the corresponding y-axis data.

    For instance:

    own mean_price
    5 8
    -2 23
    -4 3
    0 12

    I would like on the y-axis data to be inputted in descending order and on the x-axis to follow, hence:

    own (y) mean_price (x)
    5 8
    0 12
    -2 23
    -4 3

    with x-axis being: 8 12 23 3 (i.e. regardless of the normal ordering of numbers) and the scatter points being displayed in the order (8,5); (12,0), (23,-2); (3,-4) rather than the "normal" ordering that would follow the x axis values: (3,-4); (8,5), (12,0); (23,-2). I have tried sorting the data before but it does not quite work.

    Actually I am trying the following but with scarce results:

    Code:
    twoway (scatter own mean_price, msize(small) sort (id_mol own)) if ctry_name == "BELG", title("BELG") legend(order(1 "Own el. n.s." 2 "Own el. sign.")) xtitle("Mean price")  ylabel(, angle(0)) ytitle("own elasticity")
    Can anyone please help?

  • #2
    A marker is a coordinate pair (y,x). So this represents a fixed point in the plane - so you might want to think about your question.
    Last edited by Andrew Musau; 02 Jul 2020, 09:19.

    Comment


    • #3
      Indeed, this is a very confusing question that makes me think you may not want a scatter plot at all. A better description would be helpful, as would an example if what type of graph you are trying to create, if you have one.

      Comment


      • #4
        I am sorry for having been confusing. Maybe I should rethink the question carefully.

        Thank you,

        Federico

        Comment


        • #5
          Perhaps this will help: https://www.statalist.org/forums/for...ailable-on-ssc (and if needed search for other mentions of multidot). .

          Comment

          Working...
          X