10 examples of 'ax.set_xlabel' in Python

Every line of 'ax.set_xlabel' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
41def setXLabel(self, label):
42 plt.xlabel(label)
372def set_axis_labels ( self , x ) :
373 pass
532def set_xlabel(self, lbl):
533 """
534 Set the label or title of the x axis
535
536 @param lbl :: x axis lbl
537 """
538 l = self.get_figure()._graph.activeLayer()
539 l.setXTitle(lbl)
692def _label_axes_latitude(self, axis_labels, ax):
693 """ Set the x and y axis labels for a latitude slice. """
694 x_label, y_label = axis_labels
695 if x_label is None:
696 x_label = self._get_label_x()
697 if y_label is None:
698 y_label = self._get_label_z()
699 ax.set_xlabel(x_label)
700 ax.set_ylabel(y_label)
104def setup_axis(X, Y, ax=None, fig=None, ylims=None):
105 """Setup axis, including timer for animation or snaps
106
107 Parameters
108 ----------
109 X :
110 space disctretization to get limits
111 Y :
112 solution to get limits
113 ax :
114 ax where to put everything, if None current axes are used (Default value = None)
115 fig :
116 fig where to put everything, if None current figure is used (Default value = None)
117 ylims :
118 custom ylims, if None y axis limits are calculated from Y (Default value = None)
119
120 Returns
121 -------
122 ax
123
124 fig
125
126 time_text
127 object to fill in text
128
129 """
130 if ax is None:
131 fig = plt.gcf()
132 ax = plt.gca()
133 if ylims is None:
134 lowery = nm.min(Y) - nm.min(Y) / 10
135 uppery = nm.max(Y) + nm.max(Y) / 10
136 else:
137 lowery = ylims[0]
138 uppery = ylims[1]
139 ax.set_ylim(lowery, uppery)
140 ax.set_xlim(X[0], X[-1])
141 time_text = ax.text(X[0] + nm.sign(X[0]) * X[0] / 10,
142 uppery - uppery / 10,
143 'empty', fontsize=15)
144 return ax, fig, time_text
52def set_x_label(self, xlabel):
53 self.plot.xaxis[0].axis_label = xlabel
246def auto_axis_label(ax, y_scale, z_non_zero=True, log_x=False):
247
248 if tex_on:
249 if z_non_zero:
250 ax.set_ylabel("$\\mathrm{f_{\\lambda}}\\ \\mathrm{/\\ 10^{"
251 + str(y_scale)
252 + "}\\ erg\\ s^{-1}\\ cm^{-2}\\ \\AA^{-1}}$")
253
254 else:
255 ax.set_ylabel("$\\mathrm{f_{\\lambda}}\\ \\mathrm{/\\ 10^{"
256 + str(y_scale)
257 + "}\\ erg\\ s^{-1}\\ \\AA^{-1}}$")
258
259 if log_x:
260 ax.set_xlabel("$\\mathrm{log_{10}}\\big(\\lambda / \\mathrm{\\AA}"
261 + "\\big)$")
262
263 else:
264 ax.set_xlabel("$\\lambda / \\mathrm{\\AA}$")
265
266 else:
267 if z_non_zero:
268 ax.set_ylabel("f_lambda / 10^" + str(y_scale)
269 + " erg s^-1 cm^-2 A^-1")
270
271 else:
272 ax.set_ylabel("f_lambda / 10^" + str(y_scale)
273 + " erg s^-1 A^-1")
274
275 if log_x:
276 ax.set_xlabel("log_10(lambda / A)")
277
278 else:
279 ax.set_xlabel("lambda / A")
1516def _add_axis_labels(self):
1517 """Add labels to the left and bottom Axes."""
1518 for ax, label in zip(self.axes[-1, :], self.x_vars):
1519 ax.set_xlabel(label)
1520 for ax, label in zip(self.axes[:, 0], self.y_vars):
1521 ax.set_ylabel(label)
21def addLabels(fig,xlabel,ylabel,xunit ='-',yunit = '-'):
22 fig.setLabel('left', ylabel, units=xunit)
23 fig.setLabel('bottom', xlabel, units=yunit)
270def set_xticklabels(xticklabels,
271 rotation = 'vertical',
272 fontsize = 16,
273 **kargs):
274 ax = plt.gca()
275 ax.set_xticklabels(xticklabels, rotation = rotation,
276 fontsize = fontsize, **kargs)

Related snippets