Message Boards Message Boards

[✓] Set logarithmic and reversal scaling axes?

GROUPS:

I'm trying to create a Hertzsprung-Russell Diagram which requires both axes to be logarithmic and the x-axis to be reversed. I've found the ScalingFunctions option for the ListPlot command, but it can only seem to do one change to each axes at a time ({"Log","Log"} or {"Reverse","Log"}).

Are there any other methods of manipulating axes or a way to get an extra change out of the ScalingFunctions option?

Thanks!

POSTED BY: Peter Driscoll
Answer
4 months ago

If you read carefully docs on ScalingFunctions especially last example, you will see arbitrary well-defined functions can be applied to scaling.

enter image description here

Did you try that? For instance:

data=Transpose[Table[Sort[RandomReal[{1,1000},100]],2]];
ListPlot[data,
    PlotTheme->"Detailed",
    ScalingFunctions->{
       {-Log[#]&,InverseFunction[-Log[#]&]},
       {Log,InverseFunction[Log]}}]

enter image description here

POSTED BY: Vitaliy Kaurov
Answer
4 months ago

Awesome! Thank you so much!

POSTED BY: Peter Driscoll
Answer
4 months ago

Group Abstract Group Abstract