1
$\begingroup$

I have the following list

data = {{1, 2, 3}, {2, 4, 9}, {3, 8, 27}}

I would like to plot second part with respect to first part but third part with respect to twice the first part in the same plot. I tried:

ListLinePlot[{data[[All, {1, 2}]], data[[All, {2 #1, 3}]]}]

which does not work. How can I fix this?

$\endgroup$
  • $\begingroup$ Does ListLinePlot[{data[[All, {1, 2}]], data[[All, {1, 3}]].DiagonalMatrix[{2, 1}]}, PlotRange -> All] suit your needs? $\endgroup$ – J. M. will be back soon Mar 3 at 13:11
  • $\begingroup$ Yes, this works. I have a further question: can I also add a constant also to first part? That is, plot part 3 w.r.t. 5+ part 1? $\endgroup$ – Shama David Mar 3 at 13:22
  • $\begingroup$ You might be interested in TranslationTransform[] and ScalingTransform[], then; e.g. TranslationTransform[{5, 0}][data[[All, {1, 3}]]]. $\endgroup$ – J. M. will be back soon Mar 3 at 13:24
  • $\begingroup$ That's exactly what I needed ! $\endgroup$ – Shama David Mar 3 at 13:45
2
$\begingroup$

This method is very general and goes beyond translation and scaling:

ListLinePlot[{{#[[1]], #[[2]]} & /@ data, {2 #[[1]], #[[3]]} & /@ data}]
$\endgroup$

Your Answer

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

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