Message Boards Message Boards

2 Replies
1 Total Likes
View groups...
Share this post:

Switching the X and Y axis in a ListLinePlot

Hello and thanks for checking out the post.

I have here a few lines of very simple code.
Rexp = {.21, .25, .3};
texp = {0, 1000, 2000};

ListLinePlot[{texp, xexp}]
This graph is just a simple line based on the numbers of text and xexp. All I want to do is switch their axis.  Right now the texp is on the Y axis and the xexp is on the X axis. How do you switch them so that I may be able to use 'Show[]' to put two plots on one graph.  Would someone be able to tell me how to do this?

I have looked everywhere I could for a solution, but I can't find anything.

2 Replies
Posted 10 years ago

if I understand correctly, then after plotting x[ t ] of your data
xexp = {.21, .25, .3};
texp = {0, 1000, 2000};
ListLinePlot[Transpose@{texp, xexp}]
you would now like to plot t[ x ] :
ListLinePlot[(Transpose[{texp, xexp}] /. {t_, x_} -> {x, t})]

Hope this helps,
POSTED BY: Peter Fleck
ListLinePlot[(Transpose[{texp, xexp}] /. {t_, x_} -> {x, t})]
In other words,
ListLinePlot[Transpose[{xexp, texp}]]
POSTED BY: Ilian Gachevski
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract