Matlab: How to obtain all the axes handles in a figure handle?

Use FINDALL: allAxesInFigure = findall(figureHandle,’type’,’axes’); If you want to get all axes handles anywhere in Matlab, you could do the following: allAxes = findall(0,’type’,’axes’); EDIT To answer the second part of your question: You can test for whether a list of handles are axes by getting the handles type property: isAxes = strcmp(‘axes’,get(listOfHandles,’type’)); isAxes will … Read more

How can I accomplish `set_xlim` or `set_ylim` in Bokeh?

One way is to can things with a simple tuple when creating a figure: figure(…, x_range=(left, right), y_range=(bottom, top)) But you can also set the x_range and y_range properties of a created figure directly. (I had been looking for something like set_xlim or set_ylim from matplotlib.) from bokeh.models import Range1d fig = make_fig() left, right, … Read more

Embedding small plots inside subplots in matplotlib

I wrote a function very similar to plt.axes. You could use it for plotting yours sub-subplots. There is an example… import matplotlib.pyplot as plt import numpy as np #def add_subplot_axes(ax,rect,facecolor=”w”): # matplotlib 2.0+ def add_subplot_axes(ax,rect,axisbg=’w’): fig = plt.gcf() box = ax.get_position() width = box.width height = box.height inax_position = ax.transAxes.transform(rect[0:2]) transFigure = fig.transFigure.inverted() infig_position = … Read more

Strange error with matplotlib axes labels

I had this same issue when working in iPython notebook. I think it can be re-created as follows: import matplotlib.pyplot as plt plt.ylabel=”somestring” # oh wait this isn’t the right syntax. … plt.ylabel(‘somestring’) # now this breaks because the function has been turned into a string Re-starting the kernel or re-importing the libraries restores plt.ylabel … Read more

What are the differences between add_axes and add_subplot?

Common grounds Both, add_axes and add_subplot add an axes to a figure. They both return a (subclass of a) matplotlib.axes.Axes object. However, the mechanism which is used to add the axes differs substantially. add_axes The calling signature of add_axes is add_axes(rect), where rect is a list [x0, y0, width, height] denoting the lower left point … Read more

How to get a matplotlib Axes instance

Use the gca (“get current axes”) helper function: ax = plt.gca() Example: import matplotlib.pyplot as plt import matplotlib.finance quotes = [(1, 5, 6, 7, 4), (2, 6, 9, 9, 6), (3, 9, 8, 10, 8), (4, 8, 8, 9, 8), (5, 8, 11, 13, 7)] ax = plt.gca() h = matplotlib.finance.candlestick(ax, quotes) plt.show()

How can I make a blank subplot in matplotlib?

You could always hide the axes which you do not need. For example, the following code turns off the 6th axes completely: import matplotlib.pyplot as plt hf, ha = plt.subplots(3,2) ha[-1, -1].axis(‘off’) plt.show() and results in the following figure: Alternatively, see the accepted answer to the question Hiding axis text in matplotlib plots for a … Read more