KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been trying for weeks to plot 3 sets of (x, y) data on the same plot from a .CSV file, and I'm getting nowhere. My data was originally an Excel file which I have converted to a .CSV file and have used pandas to read it into IPython as per the following code: from pandas import DataFrame, read_csv import pandas as pd # define data location df = read_csv(Location) df[['LimMag1.3', 'ExpTime1.3', 'LimMag2.0', 'ExpTime2.0', 'LimMag2.5','ExpTime2.5']][:7] My data is in the following format: Type mag1 time1 mag2 time2 mag3 time3 M0 8.87 41.11 8.41 41.11 8.16 65.78; ... M6 13.95 4392.03 14.41 10395.13 14.66 25988.32 I'm trying to plot time1 vs mag1 , time2 vs mag2 and time3 vs mag3 , all on the same plot, but instead I get plots of time.. vs Type , eg. for the code: df['ExpTime1.3'].plot() I get 'ExpTime1.3' (y-axis) plotted against M0 to M6 (x-axis), when what I want is 'ExpTime1.3' vs 'LimMag1.3' , with x-labels M0 - M6 . How do I get 'ExpTime..' vs 'LimMag..' plots, with all 3 sets of data on the same plot? How do I get the M0 - M6 labels on the x-axis for the 'LimMag..' values (also on the x-axis)? Since trying askewchan's solutions, which did not return any plots for reasons unknown, I've found that I can get a plot of ExpTime vs LimMag using df['ExpTime1.3'].plot(), if I change the dataframe index (df.index) to the values of the x axis (LimMag1.3). However, this appears to mean that I have to convert each desired x-axis to the da
Tags (comma-separated)
Save Edits
Cancel