1
$\begingroup$

I'm capitalizing on someone else's work with regard to steam tables. I wanted to make some unusual kind of charts. I can get most of the way to the chart design. But I have trouble with the x-axis, which I'd like it to be the temperature in the calculations (tvalue)

tvalue = {5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 300, 350,400}

pcurve1 =Table[ThermodynamicData["Water","Enthalpy", {"Temperature" -> Quantity[tvalue,"DegreesCelsius"],"Pressure" -> Quantity[i, "Bar"]}], {i, {500, 50, 40, 30, 20,10,5, 2, 1}}];

ListLinePlot[pcurve1,PlotLabels -> {500, 50, 40, 30, 20, 10, 5, 2, 1}, PlotRange -> All]

This produces a chart close to what I want. Except that the x-axis is the sequence from 1 to 14, from the tvalue list. But what I want the x-axis to be is the actual temperatures used to determine the enthalpy (5, 10, 20, etc.). DataRange will insert a range of values, but not consistent with tvalue.

I tried the folks at Wolfram and they told me just to transpose tvalue, and pcurve1. Doesn't work though.

Your thoughts are welcome.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

You can construct lists of {x, y} pairs from pcurve1 and tvalue using (1) Transpose (or Thread), or, alternatively, (2) TemporalData and specify the horizontal ticks using the option Ticks:

ListLinePlot[Thread[{tvalue, #}] & /@ pcurve1,
 PlotLabels -> {500, 50, 40, 30, 20, 10, 5, 2, 1}, 
 Ticks -> {Delete[tvalue, List /@ {2, 4, 5}], Automatic},
 ImageSize -> Large]

enter image description here

ListLinePlot[TemporalData[pcurve1, {tvalue}],
 PlotLabels -> {500, 50, 40, 30, 20, 10, 5, 2, 1}, 
 Ticks -> {Delete[tvalue, List /@ {2, 4, 5}], Automatic},
 ImageSize -> Large]

enter image description here

Note: I deleted several elements from tvalue to specify horizontal ticks to avoid label overlaps.

$\endgroup$
2
  • $\begingroup$ That's great. Thanks!!!! $\endgroup$
    – BruceR
    Commented Sep 20, 2021 at 17:13
  • $\begingroup$ I think I followed everything until Ticks -> {Delete[tvalue, List /@ {2, 4, 5}]. What exactly is the Delete... doing? $\endgroup$
    – BruceR
    Commented Sep 20, 2021 at 17:15

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.