venkysmarty
venkysmarty

Reputation: 11431

about subplot in python

I am reading about machine learn algorithms using python. Though I am new to python I am trying to follow most of the stuff. But I am finding difficult to understand below

 axprops = dict(xticks=[], yticks=[])
 createPlot.ax1 = plt.subplot(111, frameon=False, **axprops)  

In above code what **axprops mean here? and why we are appending ** before axprops?

What is xticks and yticks in this context?

What is the declaration of subplot. I am not able to find one when I searched in Internet.

Thanks

Upvotes: 0

Views: 119

Answers (1)

Ilja
Ilja

Reputation: 2114

Google knows nothing about axprops, it's an arbitraty variable name - search for *args and **kwargs (the latter meaning, "keyword arguments") in the python tutorial, or on SO as stated in the comment.

You can pass a lot of keyword arguments to your function in one call by providing a dictionary (in which the keys are limited to parameters the funtion expects, of course, but need not contain all parameters). In your example it's completely useless (well, a question of style), but you could construct this dictionary dynamically inside ifs, for example...

In this case you pass those arguments to tell the subplot not to draw any ticks (just try without passing the axprops, and you will see what this changes, it will autogenerate ticks which it thinks appropriate for the data)

Upvotes: 1

Related Questions