10000 Export_graphviz() defaults "Helvetica" font by wstates · Pull Request #14290 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

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

Closed
wants to merge 11 commits into from
Closed

Export_graphviz() defaults "Helvetica" font #14290

wants to merge 11 commits into from

Conversation

wstates
Copy link
@wstates wstates commented Jul 8, 2019

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?

Non-English character text cannot be displayed
Added a parameter that controls the dot file "fontname"

Signed-off-by: wstates <states@yeah.net>
Copy link
Member
@rth rth left a 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'):
Copy link
Member

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

Copy link
Member
@jnothman jnothman left a 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.

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line


fontname : str,optional (default='helvetica')
Copy link
Member

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?

Copy link
Author

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.

@@ -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
Copy link
Member

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

Copy link
Author

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

Copy link
Member

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!

Copy link
Author

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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fontname : str,optional (default='helvetica')
fontname : str, optional (default='helvetica')

Copy link
Member

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

@@ -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
Copy link
Member

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."?

Copy link
Author

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?

Copy link
Member

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?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

demo

use the default if it is normal

demo5
if it is not normal,the default value will not be used

Copy link
Author

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.

@wstates wstates closed this Aug 4, 2019
@wstates wstates deleted the test branch August 4, 2019 02:56
@jnothman
Copy link
F438 Member
jnothman commented Aug 4, 2019

Why have you closed this? Sorry we seem to have lost track of it. Would you still like to see it finished?

@wstates
Copy link
Author
wstates commented Aug 8, 2019

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.
my grammar is not good, I don't want to continue.

@thomasjpfan
Copy link
Member

@amueller Why is the fontname adjusted when rounded=True?

@amueller
Copy link
Member
amueller commented Aug 8, 2019

@thomasjpfan not my doing, despite me taking the blame.

@jnothman
Copy link
Member
jnothman commented Aug 8, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0