I would like to ask you if you have any advice… as I can’t sort out one issue when creating plots with Gadfly in Julia v0.5.
I need to plot matrices, which have discrete values (from 0 to 127), so that each value is plotted with one colour. See the attached examples.
I create them with the following line:
plot( x = jjj - 1 , y = iii - 1 , color = iiijjjvalues ,
Scale.color_discrete ,
Guide.xticks( ticks = collect( 0 : 5 : number_of_observations_arm_2 ) ) ,
Guide.yticks( ticks = collect( 0 : 5 : number_of_observations_arm_1 ) ) ,
Guide.xlabel( "# successes on arm 1 (out of $number_of_observations_arm_2)" ) ,
Guide.ylabel( "# successes on arm 0 (out of $number_of_observations_arm_1)" ) ,
Guide.colorkey( "Consecutive \n failures" ) ,
Coord.cartesian( yflip = true , fixed = true ) ,
Geom.point,
Theme( panel_fill = nothing , highlight_width = 0pt ,
default_point_size = my_point_size , plot_padding = 5pt ,
major_label_font_size = 11pt , minor_label_font_size = 9pt )
)
You can see in the legend that the same sequence of colours appears in the two plots: blue, gold, pink, green, violet, red, grey, etc. These colours appear in the plot in this order if you follow the first column from top to bottom, then then second column, etc.
However the legend then looks weird, because it would be natural to have the colours ordered by the values they correspond to (0, 1, 2, 3, 4, etc.). Moreover, as the colour ordering prevails, the same values are plotted in different colours in these two plots, which is not very helpful - I need to include many figures like this and I would prefer if I only needed one legend, the same for all of them.
I wonder whether you would have a suggestion for a quick fix or where I could get some help with it. Basically, I need to get control of how the colours are assigned to values and how they appear in the legend.
Thanks a lot!
Peter.
Plot1:
Plot2: