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

matplotlib savefig in jpeg format

You can save an image as ‘png’ and use the python imaging library (PIL) to convert this file to ‘jpg’: import Image import matplotlib.pyplot as plt plt.plot(range(10)) plt.savefig(‘testplot.png’) Image.open(‘testplot.png’).save(‘testplot.jpg’,’JPEG’) The original: The JPEG image:

Adding subplots to a subplot

You can nest your GridSpec using SubplotSpec. The outer grid will be a 2 x 2 and the inner grids will be 2 x 1. The following code should give you the basic idea. import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec fig = plt.figure(figsize=(10, 8)) outer = gridspec.GridSpec(2, 2, wspace=0.2, hspace=0.2) for i in … Read more

How to change plotly figure size

Have you considered to use fig.update_layout( autosize=False, width=800, height=800,) and eventually reduce the size of your marker? UPDATE Full Code import plotly.graph_objs as go trace1 = go.Scatter( x=x1_tsne, # x-coordinates of trace y=y1_tsne, # y-coordinates of trace mode=”markers +text “, # scatter mode (more in UG section 1) text = label3, opacity = 1, textposition=’top … Read more

Subfigs of a figure on multiple pages

Everything inside \begin{figure}…\end{figure} must not be larger than a single page. In order to break it over pages, you must do it manually. Use \ContinuedFloat from the subfig package to do this: (from the subfig documentation, §2.2.3) \begin{figure} \centering \subfloat[][]{…figure code…}% \qquad \subfloat[][]{…figure code…} \caption{Here are the first two figures of a continued figure.} \label{fig:cont} … Read more

How to get matplotlib figure size

import matplotlib.plt fig = plt.figure() size = fig.get_size_inches()*fig.dpi # size in pixels To do it for the current figure, fig = plt.gcf() size = fig.get_size_inches()*fig.dpi # size in pixels You can get the same info by doing: bbox = fig.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) width, height = bbox.width*fig.dpi, bbox.height*fig.dpi

tech