matplotlib

How do I make an image mask that changes part of the image to grayscale?

You need to put a circle on the image, outside of which the image will change color to grayscale, and inside the circle the c ... = img1-41 ax_1.axis('off') ax_1.imshow(ax_1.Img) Who knows how this can be implemented? The first picture in the image: .

Finding the root of a function by the dichotomy method

I am doing a course work assignment on Numerical Methods and Computer Modeling: find the root of a function and display the f ... ction itself, so that it searches for values only in the array, or the plotting function. Help, please, kursach is close. ;)

Python, smooth out the corners of a graph constructed using matplotlib

Help me bring the graph to a more interpolated form, if I can say so, that is, I have 5 points on the graph that are connecte ... find intermediate values, but how will it find it if my function doesn't take float values, thus outputs the error My code

Building a theoretical and empirical distribution function of a random variable (for example, Poisson) in python

Construction of a theoretical and empirical distribution function of a random variable (for example, Poisson) in python. Suppose I have some sample np. array[5,4,5,2,4]. How to construct an empirical distribution function?

Finding and visualizing the shortest path between graph vertices

I have a graph, let's say, of five vertices. And I need to find the shortest path from one vertex to another using the Floyd ... hat are included in the shortest path. That is, I need to get this list: result = [[0, 2], [2, 1]] Example in the photo:

Matplotlib, how to build a graph with logarithmic scales, and not logarithmic signatures?

I'm trying to make friends with matplotlib. I understand how to plot a graph, but I can't normally force you to draw a logari ... ow() Well, when I set the limit of 1000 divisions on the x and y axis, the graph floats away. And this should look like:

How to plot the dependence of the week name on numeric values

Here is the dataset. I want to build a graph on which the abscissa axis will have the names of the days of the week (column weekday), and on the ordinate the values of the column visits, respectively.

How to display 2 graphs with different scales on the vertical axis on the same plane in Matplotlib python?

Dear forumchane! I'm in a stupor, please tell me. So far, the output is as follows: Apparently the problem is the difference ... print(f'count = {count}') plt.plot(t_h, y_t_2, label = 'y(t)') plt.plot(t_h, x_t_2, label='x(t)') plt.legend() plt.show()

Matplotlib library: plotting a function |y| = x^2-2x-3

Hello everyone. How do I plot the function |y| = x^2-2x-3? The graph should look like this: When this code is executed, an i ... plt.xlabel('Ось x') plt.grid() plt.axis([-10, 16, 0, 10]) plt.plot(x, np.abs(y)) plt.show() Please tell me how to fix it?

Output of histograms with normal distribution. matplotlib seaborn

I'm still dealing with yesterday's question. in the first part of the code, I was able to output a histogram with a normal di ... ачения') ax1.hist(train['SalePrice'], bins=20, density=True) ax1.plot() ax2.hist(train['GrLivArea'],bins=20, density=True)

matplotlib library: plotting a function of the form |y| = f(x)

Hello everyone. How to plot a graph for the function |y| = 1-x. The graph should look like this: When this code is executed, ... ') plt.xlabel('Ось x') plt.grid() plt.axis([-10, 10, -4, 10]) plt.plot(x, abs(y)) plt.show() Please tell me how to fix it?

How to connect multiple points of a straight line and add captions for each point

There are 3 coordinates [1,2] P [3,4] Q [-3,-2] R How to draw a straight line through three points, and have annotations for each coordinate here is such an example for the point P

How do I draw a graph in a loop so that the graph of the previous cycle remains in the drawing? (matplotlib)

I started learning python quite recently, as it is convenient to draw 3D graphics with matplotlib (you need it for a diploma) ... nsZ from the code higher. But I do not know how to draw again in a loop. Please tell me, I couldn't find anything that worked

How to plot a vertical line on a graph in Python

Maybe someone knows how to build a vertical line on a graph in python , and change the color in such a way as here: The g ... z = table.values[:, 1] y = table.values[:, 2] plt.figure(figsize=(15, 7)) plt.plot(x, z) plt.plot(x, y) plt.show() Thanks!

What's the point of image channels?

There are images with the size (1280, 1918, 3) And a mask to it with the size (1280, 1918, 1) fig, axes = plt.subplo ... figsize=(34, 34)) axes[0].imshow(m) axes[1].imshow(m[...,0]) axes[2].imshow(m[...,1]) axes[3].imshow(m[...,2]) plt.show()

How to plot sin on the chart at the maximum and at the minimum

How in python can I draw a sinusoid going to the top and bottom of the graph? A piece of code. x1=[7,-1,-6,1,10] y1=[2,-2,7,1 ... d the sinusoid is again not at the edges. Speech how to use standard tools to stretch the sinusoid to the edges of the graph.

3D drawing from an array

How can I make a 3d drawing on an array? let me explain. in my case, the array is a set of heights, i.e. the Z coordinate, an ... mple: [4,8,12,1 3,9,11,3 5,10,10,5 2,15,7,4] You can take the coordinates for the angle and step at your own discretion

How to build a piecewise function in matplotlib (python)?

def s_similar(x): if x < a: return 0 elif a <= x <= ((a + b) / 2): return (2 * ((x - a) ** 2 ... ven possible to build a piecewise function, using numpy and matpotlib, so as not to search for a discrete function manually ?

Basemap python. Problem with installation via pip

Hello. I have a problem installing basemap (a package for python that is included in the matplotlib suite for visualizing geo ... rect installation from the repository also for some reason does not cure the situation. Some tips can be found here and here.

Python (jupyter) animated graph

Can you tell me if it is possible to draw animated graphics in jupyter, like a real-time CPU load graph? I'm trying to monito ... plt.plot(x) The graph is calculated all and drawn all at once, tell me how to make animation and is it possible at all?