2

I am trying to construct a ridgeline plot using joypy. I have a dataframe with 2 columns: one of the columns represents the names of the samples and the other the values to be plotted:

sampleName value

C -11

C -12

C -14

A -10

A -8

B -6

B -7

Upon plotting the values above with the following command:

import joypy

joypy.joyplot(data = data_to_plot, by = 'sampleName', column = ["value"], legend = True)

I get this plot, which is ordered (as it looks like) by the values in increasing order (from more negative to less negative in the case of this data).

plot

Is there a way to specify the ordering, e.g. by the sample names, and input one's own order of plotting, instead of C->A->B, A->B->C?

Marcus Campbell
  • 2,746
  • 4
  • 22
  • 36
akkab
  • 401
  • 1
  • 6
  • 19

1 Answers1

0

I've been trying to do the same thing, and it turns out sorting your data does the trick.

data_to_plot = data_to_plot.sort_values('sampleName', ascending = False)
Joanne
  • 1