Trying to run px.line chart but for some reasons the lines are all over the place using my dataframe columns

I have been trying to create a plotly line chart using columns from my dataframe the output does not create a line view.

My code is;

fig = px.line(ElectricCarData, x=‘Brand’, y=‘Accel’)

The output view is:

Many thanks

@Dashz are you sure a line chart is the most appropriate type of graph for this since your y-axis is categorical data? If that’s really what you want maybe a connected scatter plot might do the trick.

Hi @jhupiterz,

I have just had a look at the link you have provided the issue I think for me is that I had been attempting to use it earlier for my charts but I couldn’t input csv dataframe and the other issue is that in my csv there are 33 brands so there would be a lot of data to manually input x and y plot option.

Many thanks :slightly_smiling_face:

Hi @jhupiterz,

Is there a way to change the first line to incorporate my code as I can put my df name but for the how may I substitute this?

df =“country in [‘Canada’, ‘Botswana’]”)

Many thanks

@Dashz so the is just going to fetch the gapminder dataset that’s it.
You should remove that line completely and instead put your own data.

1 Like

Hi @jhupiterz,

Thanks for your reply, I think it’s the data type issue as you’ve mentioned I had removed the line above but the data view was as shown in the screenshot and so I have reverted to using a bar chart instead.

For my other questions with the datasets I might attempt an area and see if they function.

Many thanks