How to create multiple lines in a line chart

I would like to plot 3 line charts (1 for each category) against the year. I name the y-axis based on the row names in the data set but it is incorrect. How should I define the naming to pull the data from the dataset?

from bokeh.plotting import figure
from import output_file, output_notebook, show
from bokeh.layouts import column
from bokeh.models import HoverTool, ColumnDataSource

data = pd.read_csv('saving.csv',dtype={'year': object})


p.line(x= data.financial_year, y =
p.line(x= data.financial_year, y = data.entertainment)


# create a new plot with a title and axis labels
p = figure(title="Monthly expenditure", x_axis_type='datetime', x_axis_label="financial year", y_axis_label="expenses")

# add a line renderer with legend and line thickness
p.line(x, y, legend_label="expenses", line_width=2)

# Plot date along the x axis and price along the y axis
p.line(data['financial_year'], data['rent'], line_color='green')
p.line(data['financial_year'], data['entertainment'], line_color='blue')

# show the results

This is a sample of my data set.

What does this mean? It’s not plotting at all? Is there an error? If it is plotting, are the scatter points not what you expect? Or the axes are not what you expect? Something else? Your code looks reasonable at a glance, but since you have not provided everything needed for someone else to run and investigate the code direclty, it’s not possible to speculate without know actual details about how the output failed to meet your expectations.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.