Created
March 7, 2012 05:08
-
-
Save pmagwene/1991040 to your computer and use it in GitHub Desktop.
crude dotplot in matplotlib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assumes pyplot and numpy are in namespace | |
import string | |
x = [1,4,5,9,9,11,13,14,18,20] | |
cats = [i for i in string.letters[:10]] | |
maxx = max(x)*1.10 | |
ax = axes([0,0,1,1]) | |
xlim(0,maxx) | |
ylim(0,11) | |
ticks = ax.yaxis.set_ticks(range(1,11)) | |
text = ax.yaxis.set_ticklabels(cats) | |
for ct,item in enumerate(cats): | |
hlines(ct+1, 0, maxx, linestyle='dashed',color='0.9') | |
plot(x, range(1,len(cats)+1), 'ko') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment