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$
4
  • $\begingroup$ Does ListLinePlot[{data[[All, {1, 2}]], data[[All, {1, 3}]].DiagonalMatrix[{2, 1}]}, PlotRange -> All] suit your needs? $\endgroup$ Commented Mar 3, 2019 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$ Commented Mar 3, 2019 at 13:22
  • $\begingroup$ You might be interested in TranslationTransform[] and ScalingTransform[], then; e.g. TranslationTransform[{5, 0}][data[[All, {1, 3}]]]. $\endgroup$ Commented Mar 3, 2019 at 13:24
  • $\begingroup$ That's exactly what I needed ! $\endgroup$ Commented Mar 3, 2019 at 13:45

1 Answer 1

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 and acknowledge you have read our privacy policy.

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