Flashcards
Intermediate Python - DC (matplotlib, dictionaries)
Flashcards do conjunto (12)
- 1# Make a line plot: year on the x-axis, pop on the y-axis in Matplotlib downloaded as pltplt.plot(year,pop)
- 2# Create a scatter plot between gdp_cap dn life_expplt.scatter(gdp_cap, life_exp)
- 3# Put the x-axis on a logarithmic scale in Matplotlibplt.xscale('log')
- 4# Create histogram of life_exp dataplt.hist(life_exp)
- 5# Build histogram of life_exp data with 5 binsplt.hist(life_exp,bins=5)
- 6clean up plotplt.clf()
- 7xlab = 'GDP per Capita [in USD]' ylab = 'Life Expectancy [in years]' title = 'World Development in 2007' # Add axis labels to plot in Matplotplt.xlabel(xlab)
plt.ylabel(ylab)
plt.title(title) - 8tick_val = [1000, 10000, 100000] tick_lab = ['1k', '10k', '100k'] Change x ticks from tick_val to tick_labplt.xticks(tick_val,tick_lab)
- 9np_pop=np.array(pop) # Double np_pop np_pop=np_pop*2 Add the following element to scatterplot between gdp_cap and life_exp # Update: set size argument to np_pop.plt.scatter(gdp_cap, life_exp, s = np_pop)
- 10How to add gridlines to plt plotplt.grid(True)
- 11How to add text to plt plot?plt.text(1550, 71, 'India')
- 12europe = {'spain':'madrid', 'france':'paris', 'germany':'bonn', 'norway':'oslo', 'italy':'rome', 'poland':'warsaw', 'australia':'vienna' } # Remove australiadel(europe['australia'])
Informações
- Descrição
- Easy DS FlashCards sobre Intermediate Python - DC (matplotlib, dictionaries), criado por Archimed Nemes em 02-01-2021.
- Criado por
- Archimed Nemes · jan 2021
- Atualizado
- 2 jan 2021
- Visualizações
- 0
- Avaliação