#31 in Web development & design books
Use arrows to jump to the previous/next product

Reddit mentions of Matplotlib for Python Developers

Sentiment score: 2
Reddit mentions: 2

We found 2 Reddit mentions of Matplotlib for Python Developers. Here are the top ones.

Matplotlib for Python Developers
Buying options
View on Amazon.com
or
Specs:
Height9.25 Inches
Length7.5 Inches
Number of items1
Release dateNovember 2009
Weight1.23 Pounds
Width0.7 Inches

idea-bulb Interested in what Redditors like? Check out our Shuffle feature

Shuffle: random products popular on Reddit

Found 2 comments on Matplotlib for Python Developers:

u/asoplata ยท 5 pointsr/Python

I've been using Python/NumPy/matplotlib for simple data analysis for about 2 years now, but I mean really simple - plotting time series, spectrograms, and the odd statistic. However, it's weird you posted this today, I literally decided TODAY to try out switching my analysis toolkit to R.

If you're poking around in Python for data analysis, I highly, highly recommend pandas, as if you're doing anything with data (that isn't already perfectly formatted in their files) besides simply loading it, plotting it, and calling a single NumPy function on it, look into pandas. It has significantly better and simpler data export than NumPy and is seriously capable when it comes to "cleaning" ugly data. However, as far as I've been able to tell, all the reasons I like/proselytize on behalf of pandas, is because of the things it has that R has, which is especially the two aforementioned things. AFAIK this is the main thing pandas is made for - data munging and relatively simple statistical analysis. Speaking of pandas, be a little wary of Python for Data Analysis if you're looking for something about the whole toolkit; it's written by the creator of pandas, and according to negative reviews I've seen either on reddit or Hacker News, 90% of the book is really just going over his library. So...it could be literally the best book on pandas! Just not...overall data analysis in Python. This is also hearsay, so grab some salt; I haven't read it myself.

For more complicated statistics/machine learning libraries, you want statsmodels or scikit-learn. Speaking very generally, the former is more stats / modeling focused and the latter is machine learning - however, these two things can of course be identical sometimes depending on what you're doing. I was trying to port some MATLAB code using statsmodels for the past week only to find out it's not as mature as I'd hoped (for a log-link Gamma GLM fitting, the numbers I was getting were 1. wildly different than MATLAB's [there is only one algorithm for calculation coded in at the moment] and 2. it took 15x as long as MATLAB to run on the same data set, reaching near-unfeasibility on the scale I need). Scikit-learn may be more mature, so check that out first (especially if you can speak machine learning). The issues I had with statsmodels really aren't damning; however, those + matplotlib combined is what has driven me to R...

Matplotlib's documentation is an abomination for someone who really "wants to do it right"; IMHO it's mainly geared at people (like scientists) who just want the minimum working code to get something to display right and then forgetaboutit. The site/"gallery" for it is actually incredibly good if you have a specific plot type in mind, but you don't know what it's called and just want it to work! However, if you want to do things "the right way" / be pythonic, (as of 1.3.1) they make it EXTEMELY difficult IMO. The manual is an amalgamation between different people who cover different, sometimes overlapping, parts of the library, and I could never find a part of it that delved into the nuts and bolts enough to really grasp the overall structure. When I say the right way, I mean follow the class hierarchy (or hell just try to grasp it in an actionable way), call the right methods from the different subclasses (I can still never remember, "do I need to call plt/pyplot for the title or xlabels? or ax? or the actual figure object?"), etc. The closest I've ever come to finding good sources for following the THINKING of the library (which, rumor has it, is somewhat based on the construction of MATLAB's plotting library) is Matplotlib for Python Developers, which I haven't read, and the matplotlib tutorials here, some of which are by actual matplotlib devs. There's Python people I know and trust who really love matplotlib and who get the overall structure - but I've got so much fatigue from trying to understand the library on an intermediate level that I'm probably about to give in to the comforting embrace of R's ggplot2. Note that there is an attempt to port ggplot to Python, actually.

I can't honestly tell what the speed of the community/development has been for the Python tools these past few years has been, but apparently both R's and MATLAB's community have been gaining speed greatly, coupled with nice improvements to their actual engines. E.g. supposedly R doesn't have the same memory problems it used to have. Also, if you're into that, R right now is supposed to be the state of the art when it comes to statistics, in that statiscians doing math research are actually very likely to publicly code up their brand-new statistical thingies [scientifically speaking] and make them available in R themselves. Python is a general purpose programming language, while R is decidedly NOT trying to do that, but supposedly the level of sophistication of both 1. the availability of statistical libraries/functions and 2. the efficiency of implementation are far superior in R, and given how tied the statistical community is to it, Python simply will not be able to catch up in the near future. In a decade everything may begin to reverse, and I for one would welcome our Python-lang and Python-world-class-analysis overlords, but I don't think it's going to happen very soon.

That said, the Python community has been strangely open to working WITH R...through Python, through rpy2 or, interactively, through rmagic in ipython (actually rmagic may be deprecated in favor of rpy2?). Pandas' data structures are very similar to R's, and I haven't used rpy2 but a few times and it didn't seem immature.

Both langs also supposedly have decent d3.js web-style visualization deployment, though I'm not sure what the specific libraries' names are.

u/gerserehker ยท 1 pointr/learnpython

Ah how silly of me, I completely ruled out the part where I rooted the result and then drew it with my compass!

OK, I'm trying to work out what you've posted now... For a lot of these I need to have the axis in the center of the screen rather than the far edges.

Although I just entered what you did and the value isn't really different, it's just that I can't see the origin in the center.

With center

Without center....

Also - Why is it elliptical? Is that some setting or is that the way that's meant to be? Bit confused about that.

I'm still struggling to 'read' it a bit.... I'll try to explain in sentences what's happening (sometimes that helps....)

****

x = np.linspace(-1,1,1001)

This creates an array of values from -1 through to +1, and the 1001 is the amount of steps that are taken between them. The higher the third value, the greater the amount of steps and as a result accuracy of the graph curve.

y_upper = np.sqrt(1.0-x**2)

This creates an array of positive values based on the array x, so in this case there will be 1001 positive values. Assigns to the variable y_upper

y_lower = -y_upper

This creates an array of inverse values to the previous array.

plt.plot( x,y_upper,'r', x,y_lower,'r')

This plots both arrays onto the axis, in red.

plt.show()

This just displays the graph

****

So that's my understanding of the above - anything glaring that I'm missing?

Any reason that it's an ellipse and not actually a circle?

Thanks very much.

Also - I was considering getting a book - I'm not sure what your thoughts are on that.

I was thinking about this one or maybe this one. Perhaps this is way too basic to warrant a book. Though It would be nice to continue learning as I move through onto A Level material (maths) as well.

Cheers!