Rishikesh Kumar Rishi has Published 1162 Articles

Scatter plot and Color mapping in Python

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Mar-2021 10:07:43

587 Views

We can create a scatter plot using the scatter() method and we can set the color for every data point.StepsCreate random values (for x and y) in a given shape, using np.random.rand() method.Create a scatter plot of *y* vs. *x* with varying marker size and/or color, using the scatter method ... Read More

Change figure window title in pylab(Python)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Mar-2021 10:07:24

2K+ Views

Using pylab.gcf(), we can create a fig variable and can set the fig.canvas.set_window_title('Setting up window title.') window title.StepsUsing gcf() method, get the current figure. If no current figure exists, a new one is created using `~.pyplot.figure()`.Set the title text of the window containing the figure, using set_window_title() method.. Note that ... Read More

Change x axes scale in matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:44:15

14K+ Views

Using plt.xticks, we can change the X-axis scale.StepsUsing plt.plot() method, we can create a line with two lists that are passed in its argument.Add text to the axes. Add the text *s* to the axes at location *x*, *y* in data coordinates, using plt.text() method, where the font size can ... Read More

How to change fonts in matplotlib (python)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:42:43

2K+ Views

Using plt.text() method, we can increase the font size.StepsUsing plt.plot() method, we can create a line with two lists that are passed in its argument.Add text to the axes. Add the text *s* to the axes at location *x*, *y* in data coordinates, using plt.text() method. Font size can be ... Read More

Python matplotlib multiple bars

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:41:20

300 Views

We can use a user-defined method, autolabel, to annotate the axis value. Before that, we can initialize the fig and ax using plt.subplots() method.StepsCreate lists, labels, men_means, and women_means with different data elements.Return evenly spaced values within a given interval, using numpy.arrange() method.Set the width variable i.e., width=0.35.Create fig and ... Read More

Annotate bars with values on Pandas bar plots in Python

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:39:08

301 Views

In this program, we can create a data frame and can plot a bar using df.plot.bar(x='lab', y='value', color='#5fba34') plot.StepsUsing Panda’s dataframe, we can create a data frame with the given dictionary, where the keys are lab and value, values of these keys are lists, respectively.Using Pandas plot.bar() method, we can ... Read More

Getting vertical gridlines to appear in line plot in matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:37:50

3K+ Views

Using plt.grid(axis="x") method, we can plot vertical gridlines.StepsMake a list of numbers.Set the X-axis label using plt.xlabel() method.Set the Y-axis label using plt.ylabel() method.Toggle the gridlines, and optionally set the properties of the lines, using plt.grid() method.To show the figure, use the plt.show() method, where the argument axis can be ... Read More

How to plot a high resolution graph in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:36:08

13K+ Views

We can use the resolution value, i.e., dots per inch, and the image format to plot a high-resolution graph in Matplotlib.StepsCreate a dictionary with Column 1 and Column 2 as the keys and Values are like i and i*i, where i is from 0 to 10, respectively.Create a data frame ... Read More

How do I get interactive plots again in Spyder/Ipython/matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:31:31

2K+ Views

To get interactive plots, we need to activate the figure. Using plt.ioff() and plt.ion(), we can perform interactive actions with plot.StepsCreate fig and ax variables using subplots method, where default nrows and ncols are 1.Draw a line, using plot() method.Set the color of the line, i.e., orange.Stopped the interaction, using ... Read More

How to plot two columns of a Pandas data frame using points?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Mar-2021 08:23:40

2K+ Views

First, we can initialize the dictionary with col1 and col2, convert it into a data frame. After that, we can plot this data with ‘o’ and ‘rx’ style.StepsCreate a dictionary with Column 1 and Column 2 as the keys and Values are like i and i*i, where i is from ... Read More

Advertisements