

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I remove the Y-axis from a Pylab-generated picture?
<p>To remove the Y-axis from a Pylab-generated picture, we can get the current axis of the plot and use the <strong>set_visible(False)</strong> method.</p><h2>Steps</h2><ul class="list"><li><p>Set the figure size and adjust the padding between and around the subplots.</p></li><li><p>Create x and y data points using numpy.</p></li><li><p>Plot the x and y data points using <strong>plot()</strong> method.</p></li><li><p>Get the current axis of the current figure.</p></li><li><p>Set the visibility to False for the Y-axis.</p></li><li><p>To display the figure, use <strong>show()</strong> method.</p></li></ul><h2>Example</h2><pre class="demo-code notranslate language-python3" data-lang="python3">import numpy as np import pylab # Set the figure size pylab.rcParams["figure.figsize"] = [7.50, 3.50] pylab.rcParams["figure.autolayout"] = True # Random data points x = np.random.rand(10) y = np.random.rand(10) # Plot the data points pylab.plot(x, y) # Get the current axis ax = pylab.gca() # Set Y-axis visibility to False ax.yaxis.set_visible(False) # Display the plot pylab.show()</pre><h2>Output</h2><p>It will produce the following output −</p><p><img src="https://www.tutorialspoint.com/assets/questions/media/61128/removed_Y-axis.jpg" class="fr-fic fr-dib" width="700" height="327"></p>
- Related Questions & Answers
- How to print the Y-axis label horizontally in a Matplotlib/Pylab chart?
- How do I remove a property from a JavaScript object?
- How to remove Y-axis labels in R?
- How do I remove a uniqueness constraint from a MySQL table?
- How do I remove a MySQL database?
- How do I remove multiple elements from a list in Java?
- How do I remove a substring from the end of a string in Python?
- How do I plot a spectrogram the same way that pylab's specgram() does? (Matplotlib)
- How do I remove a particular element from an array in JavaScript
- How do I remove a string from an array in a MongoDB document?
- How do I recursively remove consecutive duplicate elements from an array?
- How to remove X or Y labels from a Seaborn heatmap?
- How to plot 1D data at a given Y-value with PyLab using Matplotlib?
- How do I remove ON UPDATE CURRENT_TIMESTAMP from an existing column in MySQL?
- How to remove the first and last ticks label of each Y-axis subplot in Matplotlib?
Advertisements