Comments (5)
Have you tried not calling plt.figure()
beforehand?
If you want to remove all ambiguity, you can get or create axes in the current figure and make sure that plot_traj
uses them. Something like (not sure if it's 100% correct):
fig = plt.figure()
ax = fig.get_axes()
tp.plot_traj(..., ax=ax)
fig.savefig(...)
from trackpy.
EDIT: Spelling
So trackpy still creates the plot without the plt.figure()
I tried this
fig1=tp.plot_traj(t1, superimpose=frame[1000]) fig1.savefig(r'C:\Users\Rory\Downloads\1.png')
but get the error
`AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_24356/3548345737.py in
1 fig1=tp.plot_traj(t1, superimpose=frame[1000])
----> 2 fig1.savefig(r'C:\Users\Rory\Downloads\1.png')
AttributeError: 'AxesSubplot' object has no attribute 'savefig'`
from trackpy.
That's right. plot_traj
returns an Axes object, not a figure. So if you are being explicit about it, you should first get the figure, then tell plot_traj
to use axes within it, and then save the figure.
I'll admit I'm a bit surprised that tp.plot_traj(...); plt.savefig(filename)
doesn't work. I had thought that it was that simple.
from trackpy.
Ahhhh I see. I gave this a try
fig1 = plt.figure() ax = fig1.get_axes() tp.plot_traj(t1, ax=ax) fig1.savefig(r'C:\Users\Rory\Downloads\1.png')
getting
AttributeError: 'list' object has no attribute 'set_xlabel'
from trackpy.
You're asking the wrong person for matplotlib help, but you could do this instead.
fig = plt.figure()
ax = plt.gca()
tp.plot_traj(..., ax=ax)
fig.savefig(...)
or
ax = tp.plot_traj(...)
ax.figure.savefig(...)
from trackpy.
Related Issues (20)
- object has no attribute 'long_name' (when inspecting 'frame') HOT 2
- tp.emsd TypeError: mean() got an unexpected keyword argument 'level' HOT 7
- Working on a napari-trackpy plugin HOT 1
- TST: Weird dtype switching on Windows HOT 2
- link_df_iter giving TypeError when using pd.concat?
- level keyword argument was removed in pandas>2.0 HOT 1
- Release v0.6.2 HOT 5
- Tutorial shows problem using latest pandas HOT 2
- Linking using multiple HDF5 files. HOT 1
- Use pims.as_grey instead of image[:, :, 1] in walkthrough tutorial.
- Old Python version in installation instructions
- TST: Need to replace a GitHub action
- tp.batch does not perform batch correctly (all frames output as 0) HOT 3
- Error in trackpy.emsd() function: TypeError: mean() got an unexpected keyword argument 'level' HOT 5
- `plot_traj3d` throws error
- Locate only within specific ROI HOT 2
- [Question] methods for initial estimation of `minmass` HOT 1
- [Enhancement] Allowing possibility to convert raw image to `uint16`
- [Question] How to add optional arguments in after_locate function in tp.batch HOT 1
- Release v0.6.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trackpy.