Adding time spending indication on a matplotlib funcanimation window - matplotlib

I'm asking my question here because I haven't find any information that could solve my problem. With FuncAnimation, I'm plotting the coordinates of a moving point on a world map. Every coordinates that I take from a CSV file come from a function where I implement myself the time spending. The data are then send to a csv file that I call in my FuncAnimation function.
This is how my CSV file look like:
enter image description here
All the plotting is working but I want to improve it. This is how my plot looks like at a period t:
I would like to know if someone knows a command that would permit me to plot my coordinates and the time (on the bottom left for example) like the time spending at the bottom left of the window on my computer, something like plt.time(position= 'bottom left', time_list).
The time value would be taken from my CSV, and open as a list (time_list) at the beginning of the code.
I tried to find the function on internet but didn't find anything except how to put the time as an axe which is not what I want.

Related

DataFrame (pandas) plot opens window but there is no plot

I am unable to produce any charts in Python (matplotlib 3.5.1) with the pandas DataFrame plot() method. A window opens and the axes return value is <AxesSubplot:> as opposed to returning an object like that prints as somethig like <matplotlib.axes._subplots.AxesSubplot at 0x7f3958bcf9d0>, which is what I usually see when the plot works.
The backend is QtAgg and as far as I can tell from a poke between fora pages that report a similar problem this should be all right. This is also not a problem with needing to run matplotlib.pyplot.ion() as I see a window open, but it is black with no plot in it.
Any advice would be useful, thanks!
I have resolved the (mis)behaviour without really being sure that I have resolved the issue responsible for this misbehaviour.
As looked around for a way out, I found this discussion (How to change backends in matplotlib / Python) which made a lot of getting the back end setting right. Wondering if that would make a difference, I changed the back end. The QtAgg back end loaded by default from the matplotlibrc file and so following the instructions in the post on how to permanently change the back end, I modified the file so that the back end is now Qt5Agg. The data now plots.

How to see details of a figure like it is shown before it is saved in matplotlib?

I find several links(e.g. this one) about the size or resolution of figures plot by matplotlib.
Like , we can use pl.show(), and zoom in or zoom out before we save the figure. We can see as many details as possible in this way.
However, after we specify a dpi value in pl.savefig and save the whole figure*(png format), the details like above are lost.
Even we use a svg format, the improvement is limited like
What is the best way then? After we save the figure, can we display it and adjust it like pl.show()?
However, after we specify a dpi value in pl.savefig and save the figure, the details are lost.
The details aren't lost if you save the figure as pdf or svg, they are vector formats. Just try opening one of them in e.g. Inkscape, and you can select or edit every individual line segment.
The difference between zooming in a Matplotlib window or a saved figure is that the line width isn't re-scaled when you zoom in e.g. the saved PDF (which of course is a good thing).
After we save the figure, can we display it and adjust it like pl.show()
If that's what you want, why not simply re-run your Python script?

Photoshop jsx image grid

What I am ultimately trying to do is to create a grid of images for print that are minor variations of the same thing (different text is all). Looking through online resources I was able to create a script that changes the text and exports all of the images necessary (several hundred). What I am trying to do now is to import all of these images into a new photoshop document and lay them all out in a grid and I can't seem to find any examples of this.
Can anyone point me in the right direction to place a file at a specific coordinate (I'm using CS5 and have the design suite so if there is a way in illustrator to do this quickly...)?
Also, I'm open to other ideas on how to do this (even other programs) easily. It's for labels so the positioning on the sheet has to be pretty precise...
The art layer object has a translate() method that takes delta x and y params. You'll need to open each image, copy it to the target document, get its current location (using artLayer.bounds) and do the math to find the deltas to position it where you want it. Your deltas can be in pixels so you'll get plenty of precision.
Check out your 'JavaScript Scripting Reference' pdf in your Adobe install directory for more details.
Ok I'm marking Anna's response as the answer because though I didn't fully test it, it seems like it should work and answers the original question with jsx. However I'm also leaving my final solution in case anyone else runs across this with the same issue and may prefer this method as well.
What I ended up doing instead is using InDesign. I figured out that it has a grid option that lets you import a number of files and place them all in an equal grid in a single command. This is almost exactly what I was looking for, except that it leaves a small border/margin in between the columns and grids and mine were designed to meet exactly.
I couldn't figure out how to make it not have the border (I have very little experience with InDesign, it may be possible). However I was able to select all my images and scale them uniformly to be the correct size, then I just selected each column and dragged it over to snap to the adjacent column and the same with rows...

Core-Plot, is there an automatic way to manage the amount of numbers on the axis?

As seen on the picture below the x-axis is very crowded in this example. I do know that the scale can be changed in Core-Plotr via:
axisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(1.0f);
...so it will make it easier to read.
My question is if there is a way to automate the scaling of the axis so when it get too crowdy the axis label change to continue to be readable?
I guess that one way is to check the number of data points and change via code but it would be convenient if it is available via Core-Plot.
Here is a picture that shows my test graph:
When is get at this stage i would like to change it so it shows every 5th number and then every 10th etc.
Try the CPTAxisLabelingPolicyAutomatic labeling policy. There's a demo in the Plot Gallery example app that shows all of the available labeling policies.

Excel: Adding a Connector Line In a Chart (Have to Use a Macro)?

So I'm working on this chart in Excel, and the chart looks like two sides of a triange, like the picture at the link below:
http://a.imageshack.us/img832/6207/triangle.png.
I'd like to make a line (like, with an autoshape for example) that connects the 2 endpoints to form a triange; ie a line going from coordinates (4,1) to (4,5). I tried doing this by creating a seperate data series in excel with the coordinates of the connecting line, like:
4,1
4,2
4,3
4,4
4,5
However, in excel, all lines in this chart must have the same x coordinates. Does anyone know how to get a connecting line automatically? Say, with a macro or something? Reason I ask is because I want to be able to change these coordinates, and I want the connecting line to adjust with very little effort (ideally I could write a macro and assign it to a button that when you click it would adjust the connecting line). I have some very limited macro experience, but this is just beyond me. The type of chart I'm using is a standard line chart, where the description given by excel is "Displays trends over time or categories". Anyone know of a good resource or have some advice? Thanks.
PS I solved this problem by changing the chart type to a scatter chart, but this messed up the axes and scale, and required that those be adjusted, so I think adding a line in this manner automatically will be easier.
The scatter chart worked OK.
Used formulas included in the following image.
Perhaps you should include an image showing the problems you found.