0
$\begingroup$

I have made a database of several rods which have several physical variables and the function below plots all those variables of just one rod.

plotZVsKey[data_, key_] := Block[{plotData},
 plotData = Transpose[{data["Z [m]"], data[key]}];
 ListLinePlot[plotData, 
  PlotTheme -> "Scientific", GridLines -> Automatic,
  GridLinesStyle -> Directive[
   {Gray, Dashing[Small], RGBColor["Gray"],Opacity[0.5]}
  ],
  FrameLabel -> {"Z [m]", key}, 
  PlotRange -> All, 
  Ticks -> Automatic
 ]
];

plotRodSection[dataRod_] := Map[
 plotZVsKey[dataRod, #] &, Drop[rodVar, 1]
];

And then I use that function to see all the plots(of the variables) from just one rod of the database

plotRodSection[RodDatabase[[1]]]

But now what I want to do is the same but to show the information of two rods in the same plot. Tried Show but I need to make a distinction of colors.

$\endgroup$
  • 1
    $\begingroup$ Show[plotRodSection[RodDatabase[[1]]], plotRodSection[RodDatabase[[2]]]]? $\endgroup$ – kglr Aug 9 '18 at 21:01
  • 1
    $\begingroup$ does this give what you need: keys = {1, 2, 3}; plots = plotRodSection /@ RodDatabase[[keys]]; lines = Cases[Normal[#], _Line, Infinity] & /@ plots; coloredlines = {#, #2} & @@@ Transpose[{colors, lines}]; options = Sequence[AspectRatio -> 1/2, GridLines -> Automatic, GridLinesStyle -> Directive[{Gray, Dashing[Small], Gray, Opacity[0.5]}], Frame -> True, FrameLabel -> {"Z [m]", keys}, PlotRange -> All]; Graphics[coloredlines, options]? $\endgroup$ – kglr Aug 9 '18 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.