GoConqr has a new look! Let us know what you think.

Flashcards

Intermediate Python - DC (matplotlib, dictionaries)

Archimed Nemes DS Easy English 12 cards

Cards in this deck (12)

  1. 1# Make a line plot: year on the x-axis, pop on the y-axis in Matplotlib downloaded as pltplt.plot(year,pop)
  2. 2# Create a scatter plot between gdp_cap dn life_expplt.scatter(gdp_cap, life_exp)
  3. 3# Put the x-axis on a logarithmic scale in Matplotlibplt.xscale('log')
  4. 4# Create histogram of life_exp dataplt.hist(life_exp)
  5. 5# Build histogram of life_exp data with 5 binsplt.hist(life_exp,bins=5)
  6. 6clean up plotplt.clf()
  7. 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)
  8. 8tick_val = [1000, 10000, 100000] tick_lab = ['1k', '10k', '100k'] Change x ticks from tick_val to tick_labplt.xticks(tick_val,tick_lab)
  9. 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)
  10. 10How to add gridlines to plt plotplt.grid(True)
  11. 11How to add text to plt plot?plt.text(1550, 71, 'India')
  12. 12europe = {'spain':'madrid', 'france':'paris', 'germany':'bonn', 'norway':'oslo', 'italy':'rome', 'poland':'warsaw', 'australia':'vienna' } # Remove australiadel(europe['australia'])

Information

Description
Easy DS Flashcards on Intermediate Python - DC (matplotlib, dictionaries), created by Archimed Nemes on 02/01/2021.
Created by
Archimed Nemes · Jan 2021
Updated
Jan 2, 2021
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?