Scientific mode tutorial
In this tutorial, you operate in Scientific Mode and use Matplotlib and NumPy packages to run and debug a Python code with data visualization.
Before you start, make sure that Conda is installed.
Creating a Scientific project
Create a PyCharm project with the scientific settings predefined
Open the New Project wizard ( File | New | Project ).
Choose Scientific project type.
In the project settings dialog window, specify a project name, ensure that Conda is selected as the new environment, and alter the default data folder (if needed), then click Create .
Open the main.py file and add the following code sample:
Process warnings shown for the numpy and matplotlib imports and enable the packages in the project.
Running
Run your scientific project Shift+F10 . The code is executed and shows two graphs in the SciView. Clicking the preview thumbnail displays the respective graph:

You can modify the project code to plot only one graph at a time. In the scientific mode, you can execute fragments of your code by creating code cells.
To execute code cells:
Modify the main.py file by adding the "#%%" lines.
In the gutter, click the icon Ctrl+Enter on line with the scatter plot cell mark. Only the scatter graph will be built.
Now click the icon or press Ctrl+Enter on the line with the y versus x plot cell mark. The corresponding graph should appear.
Debugging
Let’s put a breakpoint at the line:
This line appears twice in our example code, and so there will be two breakpoints.
Right-click the editor background and from the context menu choose Debug ‘main’ .
You see the Debug tool window and the grey characters in the editor. This is the result of the inline debugging, which is enabled.
The line with the first breakpoint is blue highlighted. It means that the debugger has stopped at the line with the breakpoint, but has not yet executed it. If we execute this line (for example, by clicking the button on the stepping toolbar of the Debug tool window), we’ll see the graph:

Next, look at the Variables tab of the Debug tool window. If you click the View as Array link nearby the area array, the Data tab in the SciView window opens:

When you process excessive amount of data, you might experience degradation of debugging performance if the debugger loads variable’s values synchronously or asynchronously . It is recommended to switch to the On demand mode by selecting the corresponding loading policy. See Managing Variables Loading Policy for more information.
Mind the only row of figures in the Data tab in the SciView — it’s explained by the fact that the area array is one-dimensional.
Running in console
Right-click the editor background and choose the Run File in Console command:

This command corresponds to running a run/debug configuration for the main.py file with the Run with Python console checkbox selected:

When this command is run, the >>> prompt appears after the output in the Run tool window, and you can execute your own commands.
Summary
So, what has been done with the help of PyCharm?
The file main.py was created and opened for editing.
The source code has been entered (note the powerful PyCharm’s code completion!)
Matplotlib pyplot как установить в pycharm
In this tutorial, you operate in Scientific Mode and use Matplotlib and NumPy packages to run and debug a Python code with data visualization.
Before you start, ensure the following is installed:
Creating a Scientific project
Create a PyCharm project with the scientific settings predefined
Open the New Project wizard ( File | New | Project ).
Choose Scientific project type.
In the project settings dialog window, specify a project name, ensure the Conda is selected as the new environment, and alter the default data folder (if needed), then click Create .
Open the main.py file and add the following code sample:
Process warnings shown for the numpy and matplotlib imports and enable the packages in the project.
Running
Run your scientific project Shift+F10 . The code is executed and shows two graphs in the SciView. Clicking the preview thumbnail displays the respective graph:

You can modify the project code to plot only one graph at a time. In the scientific mode, you can execute fragments of your code by creating code cells.
To execute code cells:
Modify the main.py file by adding the «#%%» lines.
In the gutter, click the icon Ctrl+Enter on line with the scatter plot cell mark. Only the scatter graph will be built.
Now click the icon or press Ctrl+Enter on the line with the y versus x plot cell mark. The corresponding graph should appear.
Debugging
Let’s put a breakpoint at the line:
This line appears twice in our example code, and so there will be two breakpoints.
Right-click the editor background and from the context menu choose Debug ‘main’ .
You see the Debug tool window and the grey characters in the editor. This is the result of the inline debugging, which is enabled.
The line with the first breakpoint is blue highlighted. It means that the debugger has stopped at the line with the breakpoint, but has not yet executed it. If we execute this line (for example, by clicking the button on the stepping toolbar of the Debug tool window), we’ll see the graph:

Next, look at the Variables tab of the Debug tool window. If you click the View as Array link nearby the area array, the Data tab in the SciView window opens:

When you process excessive amount of data, you might experience degradation of debugging performance if the debugger loads variable’s values synchronously or asynchronously . It is recommended to switch to the On demand mode by selecting the corresponding loading policy. See Managing Variables Loading Policy for more information.
Mind the only row of figures in the Data tab in the SciView — it’s explained by the fact that the area array is one-dimensional.
Running in console
Right-click the editor background and choose the Run File in Console command:

This command corresponds to running a run/debug configuration for the main.py file with the Run with Python console checkbox selected:

When this command is run, the >>> prompt appears after the output in the Run tool window, and you can execute your own commands.
Summary
So, what has been done with the help of PyCharm?
The file main.py was created and opened for editing.
The source code has been entered (note the powerful PyCharm’s code completion!)
Can’t install matplotlib to pycharm
I have recently started to learn python programming using Python Crash Course. I am stuck as I can’t get matplotlib to work in pycharm.
I have pip installed. I have installed matplotlib using pip via command prompt.
Now, when I open pycharm and go file->settings->project interpreter->download packages and find and press install for matplotlib, I get an error: Command «python setup.py egg_info» failed with error code 1 in C:\Users\Tony\AppData\Local\Temp\pip-install-f2h0rvbb\matplotlib\ . When installing on pycharm it says its using cached file from website I didn’t download my matplotlib from.
I have tried «pip install matplotlib» from pycharm terminal and get the same error.
I have tried typing «pip install matplotlib» from cmd and it does so and says its already satisfied.
Any help or guidance would be appreciated, thanks.
3 Answers 3
Managed to get it to work by typing into pycharm terminal:
pip install updates
Then I went to file->settings->project interpreter-> then found pip via search and updated it again to be more sure. Once pip version on left hand side of column in file->settings->project interpreter showed the version to be the newest 20.0.2 which was == to the right hand side(latest version) column it was 100% updated. This can be done also by pressing the upgrade button just above the ‘show early releases’ button which looks like an eye just to the right of the right hand side column when you have already clicked on the package.
To finish I went file->settings->project interpreter-> found matplotlib and installed package successfully.
Русские Блоги
Как установить Matplotlib в Python и использовать в PyCharm или IDLE
Вы также можете попробовать установить PyCharm на шаге 5, может быть быстрее.
1. Сочетание клавиш WIN + R, введите CMD, чтобы открыть командную окно DOS.
2. Хотя у меня есть PIP во время загрузки Python, я обновить PIP, введите обновленную команду PIP:

3. Использование PIP для загрузки Matplotlib:
Если вы используете команду непосредственно:pip install matplotlibТрудно добиться успеха.
Укажите внутреннее зеркальное отображение при установке модуля:
Например, я установил Matplotlib следующим образом:
4. Введите список PIP, чтобы увидеть, какие пакеты вы установили
В это время простоя должен быть в состоянии использовать его непосредственно. Вы можете проверить это с помощью метода конечных испытаний.
5. PPLOTLIB в PyCharm:
Открыть PyCharm, выберите Файл-Настройки (File — Set), а затем нажмите на Porject (как показано ниже)

Если у вас есть пакет, который вы установите под пакет, вы можете использовать его. Но если нет, то вы можете скачать его здесь:
6. Скачать Matplotlib прямо в PyCharm:
Нажмите на маленькую сторону с правой стороны верхней части. + После:

Настройте путь загрузки:
Я попробовал оригинальный путь загрузки и Alibaba Cloud путь загрузки ошибка, и нет никаких проблем с Douban.

После настройки пути, выберите Нажмите для загрузки, вы можете. (Сконфигурированной, в основном не проблема)
7. Тест: Использование PyCharm или Идель запустить Netizen код:
В результате ОК следующим образом:
Matplotlib PyCharm

Matplotlib is a Python script module used to make 2D graphs and plots. With features to control line styles, font attributes, formatting axes, and other features.
Please enable JavaScript
It offers various graphs and plots, including error charts, bar charts, power spectra, and histograms.
Matplotlib is a multi-platform data visualization package created to deal with the larger SciPy stack and is based on NumPy arrays. One of the visualization’s biggest advantages is that it gives us visual access to vast volumes of data in forms that are simple to understand.
Install Matplotlib in PyCharm
To install the Matplotlib module in PyCharm IDE, run the following code in the IDE’s terminal.
Then import the Matplotlib module into your program in PyCharm IDE using the import keyword.
Manually Install Matplotlib in PyCharm
To manually install the famous data visualization library matplotlib in your PyCharm IDE, follow the following steps.
Go to PyCharm IDE.
Create a Python project.
Go to File on the top bar and select Project from Settings .
Click on the Python Interpreter to reach the package section.
Click on the + symbol which indicates that install a new package or library.
Clicking on the + symbol will open a new window, now search for matplotlib and click on the suggested one.
Click Install Package .
Once installed, you will get the message package matplotlib installed successfully .
Now you can import it into your current project using the import keyword.
Types of Plots With Matplotlib
As we mentioned above, you can make many different plots and graphs with the help of the Matplotlib library. So, here we are going to discuss some of them.
Line Plot With Matplotlib
As its name describes, the line plot forms a straight line on the x and y-axis. You need to insert the parameters in an array form that will create a straight 2D line.

Matplotlib Marker
A unique method of managing markers in Matplotlib graphs is called Matplotlib Marker. Graphs can be customized using marker functions because they come with various markers and other indicating icons.
Let’s understand all these with the help of examples.
for Point Marker
To form this, we use . here is the code:
for Circle Marker
Use the following code to make a o (circle) marker:
Matplotlib Grid
The grid inside the graphic can be shown or hidden using the axes object’s grid() function.
Following is the code for the Matplotlib grid:
Matplotlib Bar
To show the progress of values of different categories, you can use the bar() function.
Matplotlib Histogram
The histogram graph explains the frequency distribution in a given interval.
Conclusion
Matplotlib creates a 2D graph to visualize the inserted information. In this article, we tried to cover all the main graphs that can be plotted with the help of the Matplotlib module.
The compatibility of Matplotlib with a wide range of operating systems and graphics backends is one of its key advantages. You can rely on Matplotlib to function no matter what operating system you use or the output format you prefer.
Zeeshan is a detail oriented software engineer that helps companies and individuals make their lives and easier with software solutions.