Comments (5)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-db2cb0873245> in <module>()
481 # Convert date fields to datetime objects
482 for frame in ['workouts']:
--> 483 frames[frame]['Date'] = frames[frame]['Date'].apply(pandas.to_datetime, format=FOOD_DATE_FORMAT)
484
485 # Drop old data
NameError: name 'FOOD_DATE_FORMAT' is not defined
This is what I get when I try to run it...
But what's obvious is you shouldn't increase force and expand_points in such complicated scenarios, rather maybe decrease it from default (at least force). You may increase expand in y, but probably not in x, since it is proportional to the length of text and texts are already very long in your case. If you provide an example which can be easily run, I can try to help you with it better.
from adjusttext.
Oops, sorry about that, I was trying to whittle it down some more, and I accidentally cut out the wrong thing. I fixed it and updated the code.
I'll try what you suggested about force and expand_points, but IIRC it was only by changing them to what they are now that I was able to get it this readable. :) Thanks for your help.
from adjusttext.
This is what I got now... Were you maybe running it in Python 3? I only have Python 2 installed and set up on my laptop now.
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-1-39eade804e60> in <module>()
654 labels[num].set_fontproperties(FontProperties(weight=1000))
655 else:
--> 656 labels[num].set_text(date.strftime('%b'))
657 labels[num].set_fontproperties(FontProperties(weight=1000))
658 calories_plot.xaxis.set_ticklabels(labels, rotation=0, color=c.base01)
/usr/local/lib/python2.7/dist-packages/matplotlib/text.pyc in set_text(self, s)
1204 ACCEPTS: string or anything printable with '%s' conversion.
1205 """
-> 1206 self._text = '%s' % (s,)
1207 self.stale = True
1208
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Also, adjust_text never puts text outside axes boundaries, it even forces all provided text objects to be fully inside - I suppose what you see about that is because you actually change the boundaries after adjusting text...
from adjusttext.
No, I'm only using Python 2. I'm quite mystified, because it works fine for me, both when running it from within Emacs (C-c C-c
) and when running it from a shell (python script.py
). I see ipython in that traceback--maybe it has something to do with that? I've never used ipython.
In any case, that code isn't relevant to this problem, so it can simply be removed. I cut it out and updated the code block again.
Also, adjust_text never puts text outside axes boundaries, it even forces all provided text objects to be fully inside - I suppose what you see about that is because you actually change the boundaries after adjusting text...
Ah, I see. Well, I tried calling adjust_text
as the very last thing before the plot is shown, and it did stop the figure from increasing in size to show the off-subplot annotation, but now the annotation itself is off the figure completely:
Thanks for your help, and sorry for the trouble in running that script.
from adjusttext.
Closing, unless this is still an issue?
from adjusttext.
Related Issues (20)
- Time Limit HOT 2
- Altering Data HOT 3
- Please be mindful of the versions HOT 10
- Example of integrating seaborn.object()
- Plotly support? HOT 1
- Feature request: Fix output (specify iteration limit instead of time) HOT 2
- Is the `bioframe` dependency necessary? HOT 3
- Just started not working one day with this error HOT 2
- Version 1.0.3 has a non declared dependency on pandas HOT 1
- force_points key word removed? HOT 2
- Labels misplaced in subplots HOT 1
- Issue with "matplotlib.axes.Axes.annotate" using the arguments "xytext" and "textcoords" HOT 5
- Poor Result when avoiding a polygonal curve HOT 6
- adjustText 1.1 doesn't work properly anymore HOT 6
- Arrows disappear when using cartopy transformation HOT 11
- query_pairs unexpected argument HOT 3
- Numpy 2.0 related issue - use of 'np.Inf`' HOT 3
- update to work with numpy 2.0 HOT 1
- Prevent text overlapping scaled scatter points HOT 3
- avoid crossing of the connector lines HOT 11
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 adjusttext.