Skip to main content

Questions tagged [matplotlib]

Matplotlib is a plotting library for Python, built on NumPy and often used interactively with IPython. Its compact "pyplot" interface is similar to the plotting functions of MATLAB®.

Filter by
Sorted by
Tagged with
6 votes
1 answer
3k views

I have a list of 2D arrays which comes from a time evolution PDE (in \$(x, y, t)\$) that I solved numerically. There are \$k\$ arrays, which all have the same dimensions, and the arrays correspond to ...
Matthew Cassell's user avatar
7 votes
1 answer
830 views

The script below is used to determine relay operating times, as defined in the standard IEC 60255. The equation and relevant information can be found here. ...
Stewie Griffin's user avatar
2 votes
1 answer
165 views

I have collected large dataset of trajectories in 3D space. Below is the information about dataset- Each trajectory (shape: n x 4) is saved into CSV file with the following header: ...
ravi's user avatar
  • 439
3 votes
1 answer
499 views

The code consists of 4 functions that result in a figure with 3 subplots: a sine wave a cosine wave and the superposition of both (a bichromatic wave). I have shown in 4 ways, the first two are ...
Redsbefall's user avatar
  • 1,212
1 vote
1 answer
722 views

What is one way to change it into a program that makes use of OOP concepts? I have always programmed this way and I feel that I would somehow need to improve on it. By the way, I have deliberately ...
Benyam's user avatar
  • 13
6 votes
1 answer
339 views

I've been doing a Udemy course called: "Statistics for Data Science" and I decided to solve one of the homework with Python to kill two birds with one rocket #elon. The task was: The team of ...
Mateusz Konopelski's user avatar
12 votes
1 answer
889 views

I want to have someone reviewing and helping me get some good ideas in how to improve my current project. All information about the project is in the following github link. I would also appreciate ...
Edvardsson's user avatar
6 votes
1 answer
136 views

I'm looking for feedback on things that can be streamlined in each section. The data it creates is all needed whether it's used in a graph or not so I can't get rid of anything, just combine steps ...
letto4135's user avatar
8 votes
1 answer
1k views

I would like to have some insights on the code I created. It would be really insightful for me to get some feedback about the code, what I should do differently, if there is an easier, more elegant ...
Gábor Erdős's user avatar
5 votes
1 answer
313 views

I wrote a program for analyzing pictures. The problem I'm having is very slow processing time for medium images like 800x800. I think the root of the problem for this is the ...
RebelInc's user avatar
6 votes
1 answer
2k views

I have the following dictionary: ...
sheldonzy's user avatar
  • 471
14 votes
1 answer
12k views

I am learning Python and I tried to do a program to find K points from a set of N points, farthest as much as possible (I'm not ...
Sigur's user avatar
  • 307
6 votes
1 answer
1k views

I have made a 3D mesh. See below: And the code below: ...
riflab's user avatar
  • 61
2 votes
1 answer
238 views

I have very large data files (10 to 40 GB) which I want to plot as figures. A data file contains t matrices of size n x ...
Gilfoyle's user avatar
  • 1,167
7 votes
1 answer
9k views

I've got some time-series data. I want to examine the weekly and daily variation of that data. For weekly data I can make a plot like this, with the days along the horizontal axis: For daily data I ...
BlandCorporation's user avatar
3 votes
0 answers
3k views

I have written the following code which reads a csv file that contains a bunch of words and their sentiment value. Words like abandon may have a value of -1, while words like progress and freedom have ...
Saman Ray's user avatar
3 votes
1 answer
121 views

Given a class BasicDataFeed whose purpose is to feed questions and answers into an artificial neural network, which is tested in a non-negotiable manner as follows: ...
Seanny123's user avatar
  • 1,617
6 votes
1 answer
3k views

I decided to write a program to solve Tangram puzzles. This went a bit out of hand and I ended up with 600+ lines of code. I don't think it should have taken so much code. Here is an image of a ...
Jan Kuiken's user avatar
  • 1,523
4 votes
1 answer
2k views

The idea is exploratory data analysis, the output rendered as a histogram to get an idea of relative frequency of records: The example data set looks like this: ...
smatthewenglish's user avatar
4 votes
1 answer
361 views

I have written an error analyzer in Python for the product of our company. I want to read the log from our device and parse it, On Y axis there are different components of the device, and on X axis ...
Andrey Mazur's user avatar
18 votes
1 answer
7k views

When writing Code Review answers, it becomes often necessary to measure how long the modified code takes vs how long the OP's code takes. I needed a nice way to visualize this as a function of the ...
Graipher's user avatar
  • 41.7k
13 votes
1 answer
1k views

NOTE: See follow up to this question here I created a simple python script to plot quadratic, cubic and quartic polynomials with integer coefficients between -4 and 4. It uses numpy to find the roots ...
Linus's user avatar
  • 937
2 votes
2 answers
5k views

I have written very simple Python code to solve the simple harmonic oscillator using Euler method, but I am not sure if the program is correct or not. I would be very grateful if anyone can look at my ...
Roshan Shrestha's user avatar
5 votes
1 answer
9k views

I have a problem when adding elements to the same figure. The problem is with the legend. At each iteration I add elements and the corresponding legend. But I want the legend to include all the ...
Yochai's user avatar
  • 51
2 votes
0 answers
2k views

I'm a novice programmer. I am preparing to refactor a large project of mine to follow a model/view/controller design pattern, with separate modules for each (and eventually separate modules for the ...
Geoffrey Sametz's user avatar
2 votes
1 answer
364 views

I have following code that creates parallel swathes of specified sizes. Can someone suggest a better way of doing this? ...
user_1_1_1's user avatar
5 votes
1 answer
338 views

I was curious which U.S. president had the lowest approval rating for each day in their presidency. For example, which president had the lowest approval rating on day 42, and what was the rating. I ...
jss367's user avatar
  • 476
6 votes
2 answers
149 views

I have implemented the following Markov chain Monte Carlo MCMC algorithm for the German tank puzzle found here. I just want to make sure everything is legit and that I am not getting the right answer ...
user2879934's user avatar
3 votes
1 answer
175 views

This is a follow up to my original post: I've written a class that will start from a random Wikipedia page, then choose the first link in the main body, and then navigate following the links until ...
loremIpsum1771's user avatar
3 votes
1 answer
166 views

I've written a class that will start from a random Wikipedia page, then choose the first link in the main body, and then navigate following the links until it finds the Philosophy page. When I run the ...
loremIpsum1771's user avatar
2 votes
1 answer
3k views

I have been working on plotting time varying functions in Python as my most recent project, and would love input on optimization, proper Tkinter form, and anything that stands out like a sore thumb. ...
logical123's user avatar
3 votes
1 answer
3k views

This might be a simple issue that I am overcomplicating, but I've spent quite some time reading about polygon scaling and I've come to the conclusion that it is not precisely what I need. Given a set ...
Gabriel's user avatar
  • 629
15 votes
1 answer
6k views

I've create a simple interface for viewing a time-series as it changes over time in matplotlib. You can pause, reset or click/drag on the time-line to change the view. Have I used the matplotlib API ...
Seanny123's user avatar
  • 1,617
2 votes
1 answer
887 views

I've been trying to write nice snippet of code to simulate pi estimation by randomly throwing darts on a dartboard. While running the following code on high but reasonable numbers my mac doesn't plot. ...
oba2311's user avatar
  • 197
12 votes
1 answer
9k views

I'm creating a rectangular prism function, whose output looks like this: I think that this code can be improved by optimizing the use of np.meshgrid with a Python ...
Seanny123's user avatar
  • 1,617
6 votes
0 answers
2k views

I'm interested in making an animated movie of a zoom in on a part of the Mandelbrot set. My code works well for a few zooms, but upon trying to zoom in quite far, I find that the fractal becomes "...
Matt's user avatar
  • 339
-4 votes
1 answer
8k views

I have written a piece of code (in Py3) that graphs out the controller value of PID controller. This is so that by changing the various sub controllers (P/I/D) I can visualise how the graph changes. I'...
3kstc's user avatar
  • 125
3 votes
2 answers
961 views

When tossing a dice many many time all numbers tend to appear the same number of times, but if the number of throws is small then some numbers may appear more or less often than others, even ...
Caridorc's user avatar
  • 28.2k
5 votes
1 answer
108 views

I've got some code that plots some displays from a weather URL and locations in a CSV file. I'd like to see if anyone can make the code more efficient, the code runs fine without any errors and I'm ...
user avatar
4 votes
1 answer
4k views

This is my implementation of pricing an exotic option (in this case an up-and-in barrier option) using the Monte Carlo simulation in Python. I use NumPy where I can. Any ideas to optimize this code? <...
DudeWah's user avatar
  • 211
4 votes
1 answer
187 views

For the last couple of months I've been working on a python script that pulls data from a specific Trello list and sums up the numeric values by list (lists are split up into months). I've worked on ...
user3577138's user avatar
12 votes
3 answers
642 views

For a university assignment I had to plot different polynomial functions depending on one single parameter. That parameter gave the number of supporting points to interpolate a given function in the ...
Vogel612's user avatar
  • 25.5k
4 votes
1 answer
198 views

I like to use timeit to measure performance of small, and sometimes big, functions. However it can be uncertain as to what the 'actual' time to execute the function ...
Peilonrayz's user avatar
  • 44.6k
3 votes
3 answers
6k views

I want to improve my code. Is it possible to get the plot without repeating the same instructions multiple lines? The data comes from a Pandas' dataframe, but I am only plotting the last column (...
Aizzaac's user avatar
  • 217
5 votes
1 answer
386 views

I have been working on a project for some time and have let one Python file grow into a huge file that tries to do everything. The structure is pretty flat, and I don't like it. I've used other ...
skaz's user avatar
  • 241
5 votes
1 answer
2k views

I created an evolution simulator. It takes random chance and applies it to phenotypes of species. This was very much for fun, and I would love any input on: Readability of code Efficiency of ...
Joseph Farah's user avatar
3 votes
2 answers
13k views

There's a csv file with format: x0, y0, v00 x0, y1, v01 ... x1, y0 v10 ... And what I want to do is to plot a heat map, in which at location (x, y) the value v ...
Dracarys's user avatar
  • 131
3 votes
1 answer
2k views

I've very recently started using OOP paradigms for the code in my work (academic research). As an exercise I tried coding this quick scoreboard. I'm not interested in improving the 'display' part, I ...
nicoco's user avatar
  • 389
5 votes
1 answer
2k views

The following function represents the electrostatic potential, in spherical coordinates, due to a ring of charge \$q=1\$ and radius \$R=1\$, placed in the plane \$x\$-\$y\$: $$\phi(r,\theta) = \sum_{...
vagoberto's user avatar
  • 153
8 votes
2 answers
13k views

I'm teaching myself Python and when a friend posted this sentence Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's,...
Dan's user avatar
  • 615