Docsity

Gráficos en Python con Matplotlib, Apuntes de Tecnología

Toggle sidebar
bg1
Graphs in Python:
● Matplotlib - graphing and data visualization library
○ Main functions:
■ We have to write down all points (x, y) into array
■ Use .plot() to plot the points on canvas
■ .xlabel() and .ylabel() - gives a name to x-axis and y-axis
■ .title() - title the graph
■ .legend() - more information about the graph
■ .show() - view the plot
○ Customization:
■ .plot(color=, linestyle=’dashed’, linewidthmarker=’o’, markerfacecolor=,
markersize=)
○ Bar chart:
■ Write down height and left sides of bars
■ plt.bar()
○ Histogram:
■ Write down frequencies and set intervals
■ plt.hist()
○ Scatter plot:
■ X and Y values
■ plt.scatter()
○ Pie-chart:
■ Define labels and portions for each slice
■ plt.pie()

Vista previa parcial del texto

¡Descarga Gráficos en Python con Matplotlib y más Apuntes en PDF de Tecnología solo en Docsity!

Graphs in Python: ● Matplotlib - graphing and data visualization library ○ Main functions: ■ We have to write down all points (x, y) into array ■ Use .plot() to plot the points on canvas ■ .xlabel() and .ylabel() - gives a name to x-axis and y-axis ■ .title() - title the graph ■ .legend() - more information about the graph ■ .show() - view the plot ○ Customization: ■ .plot(color=, linestyle=’dashed’, linewidthmarker=’o’, markerfacecolor=, markersize=) ○ Bar chart: ■ Write down height and left sides of bars ■ plt.bar() ○ Histogram: ■ Write down frequencies and set intervals ■ plt.hist() ○ Scatter plot: ■ X and Y values ■ plt.scatter() ○ Pie-chart: ■ Define labels and portions for each slice ■ plt.pie()