# Switching the X and Y axis in a ListLinePlot

Posted 10 years ago
7211 Views
|
2 Replies
|
1 Total Likes
|
 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.Thanks,Vardo
2 Replies
Sort By:
Posted 10 years ago
 ListLinePlot[(Transpose[{texp, xexp}] /. {t_, x_} -> {x, t})]In other words, ListLinePlot[Transpose[{xexp, texp}]]
Posted 10 years ago
 Vardo,if I understand correctly, then after plotting x[ t ] of your dataxexp = {.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,Peter