-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Export_graphviz() defaults "Helvetica" font #14290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Non-English character text cannot be displayed Added a parameter that controls the dot file "fontname" Signed-off-by: wstates <states@yeah.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM, apart for the comment below.
Also, please add an entry to the change log at doc/whats_new/v22.rst
. Like the other entries there, please reference this pull request with :pr:
and credit yourself with :user:
.
@@ -183,7 +183,7 @@ def __init__(self, max_depth=None, feature_names=None, | |||
class_names=None, label='all', filled=False, | |||
impurity=True, node_ids=False, | |||
proportion=False, rotate=False, rounded=False, | |||
precision=3, fontsize=None): | |||
precision=3, fontsize=None, fontname='helvetica'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add it to the docstring above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If changing the default to sans works, I'd consider that, since sans will often choose Helvetica on an appropriate platform.
Non-English character text cannot be displayed Added a parameter that controls the dot file "fontname" Signed-off-by: wstates <states@yeah.net>
sklearn/tree/export.py
Outdated
@@ -149,7 +149,12 @@ def plot_tree(decision_tree, max_depth=None, feature_names=None, | |||
|
|||
fontsize : int, optional (default=None) | |||
Size of text font. If None, determined automatically to fit figure. | |||
optional (default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line
sklearn/tree/export.py
Outdated
|
||
fontname : str,optional (default='helvetica') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does setting the default to 'sans'
address the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set fontname= "sans" normal displays
But I did not change the default value.
Only optional parameters were added.
sklearn/tree/export.py
Outdated
@@ -733,6 +735,11 @@ def export_graphviz(decision_tree, out_file=None, max_depth=None, | |||
Number of digits of precision for floating point in the values of | |||
impurity, threshold and value attributes of each node. | |||
|
|||
fontname : str,optional (default='helvetica') | |||
Set dot file "font name" field | |||
Output font cannot display optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this description. Fine to just remove this sentence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm so sorry ^_^! My English is not so good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries! You're making a much better attempt than I am at most contributors' native languages!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have modified it.
@@ -733,6 +735,10 @@ def export_graphviz(decision_tree, out_file=None, max_depth=None, | |||
Number of digits of precision for floating point in the values of | |||
impurity, threshold and value attributes of each node. | |||
|
|||
fontname : str,optional (default='helvetica') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fontname : str,optional (default='helvetica') | |
fontname : str, optional (default='helvetica') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wstates could you accept this suggestion
sklearn/tree/export.py
Outdated
@@ -733,6 +735,10 @@ def export_graphviz(decision_tree, out_file=None, max_depth=None, | |||
Number of digits of precision for floating point in the values of | |||
impurity, threshold and value attributes of each node. | |||
|
|||
fontname : str,optional (default='helvetica') | |||
Set output dot file font | |||
optional font name "sans" or other correct font |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to suggest `"sans" may have better language support."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
sorry,am I using the wrong word again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make the line up to 79 characters?
Set the font used in the output dot-file.
(I am unsure of what you mean with the second sentence)
The default font is 'helvetica' and can be replaced with any available font (maybe?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make the line up to 79 characters?
Set the font used in the output dot-file. (I am unsure of what you mean with the second sentence) The default font is 'helvetica' and can be replaced with any available font (maybe?)
I have modified it.
Why have you closed this? Sorry we seem to have lost track of it. Would you still like to see it finished? |
This parameter may not be commonly used. |
@amueller Why is the fontname adjusted when |
@thomasjpfan not my doing, despite me taking the |
Sorry you feel uncomfortable about your grammar. We can support you there
or find other contributors to help. Sorry this has taken a while and we
have not been as helpful with the English as we could be.
I would like the fontname to be configurable or even sans by default for
the reasons you have stated.
|
Non-English character text cannot be displayed
Added a parameter that controls the dot file "fontname"
Signed-off-by: wstates states@yeah.net
Reference Issues/PRs
What does this implement/fix? Explain your changes.
Any other comments?