0
$\begingroup$

Imagine I have two lists:

x={x1,x2,x3,x4,...}
y={y1,y2,y3,y4,...}

And I want a listplot

ListPlot[Transpose[{x,y}]]

Would do the job. What can I do if I want a plot with the order of the x axis shifted? Something like: instead of the latter code, it'd read

ListPlot[Transpose[{-x,y}]]

This comes from HR diagrams, in where Temperature decreases as "the x axis grows".

Specifically, I have this plot:

rough HR diagram attempt

And I'd like to invert $\log T$ from $~4.4$ to $~3.5$

The code is

ListPlot[Transpose[{temp, lum}], PlotRange -> Full, 
 PlotTheme -> "Detailed", PlotStyle -> {Automatic, Green}, 
 AxesLabel -> Automatic, Frame -> True, 
 FrameLabel -> {Style["Temperatura Log T [K]", FontSize -> 22, Bold], 
   Style["Luminosidad Log L [\!\(\*SubscriptBox[\(L\), \(sol\)]\)]", 
    FontSize -> 22, Bold]}, ImageSize -> Large]

Thanks in advance.

$\endgroup$
1
  • 1
    $\begingroup$ {temp//Reverse, lum}] ? $\endgroup$
    – cvgmt
    Commented Oct 11, 2020 at 23:26

1 Answer 1

6
$\begingroup$

How about:

data = Table[{x, x^2}, {x, 0, 5}];

ListLinePlot[data, ScalingFunctions -> {"Reverse", Identity}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.