Every line of 'matplotlib flip y axis' 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.
104 def 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
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
79 def flip_y(self): 80 """ 81 Flip the y_min/y_max limits. 82 """ 83 self.y_lim_helper.flip_limits()