Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66c5aa6

Browse files
committed
Merge pull request matplotlib#4244 from mdboom/issue4239
Fix : Don't include scientific notation in path strings Closes matplotlib#4239
2 parents be6a691 + 0c8c640 commit 66c5aa6

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
Binary file not shown.

lib/matplotlib/tests/test_path.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ def test_xkcd():
9999
ax.plot(x, y)
100100

101101

102+
@image_comparison(baseline_images=['marker_paths'], extensions=['pdf'],
103+
remove_text=True)
104+
def test_marker_paths_pdf():
105+
N = 7
106+
107+
plt.errorbar(np.arange(N),
108+
np.ones(N) + 4,
109+
np.ones(N))
110+
plt.xlim(-1, N)
111+
plt.ylim(-1, 7)
112+
113+
102114
if __name__ == '__main__':
103115
import nose
104116
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

src/_path.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ int __convert_to_string(PathIterator &path,
989989
{
990990
#if PY_VERSION_HEX < 0x02070000
991991
char format[64];
992-
snprintf(format, 64, "%s.%dg", "%", precision);
992+
snprintf(format, 64, "%s.%df", "%", precision);
993993
#endif
994994

995995
char *p = *buffer;
@@ -1031,14 +1031,14 @@ int __convert_to_string(PathIterator &path,
10311031
for (int i = 0; i < size; ++i) {
10321032
#if PY_VERSION_HEX >= 0x02070000
10331033
char *str;
1034-
str = PyOS_double_to_string(x[i], 'g', precision, 0, NULL);
1034+
str = PyOS_double_to_string(x[i], 'f', precision, 0, NULL);
10351035
if ((p = __append_to_string(p, buffer, buffersize, str)) == NULL) {
10361036
PyMem_Free(str);
10371037
return 1;
10381038
}
10391039
PyMem_Free(str);
10401040
if ((p = __append_to_string(p, buffer, buffersize, " ")) == NULL) return 1;
1041-
str = PyOS_double_to_string(y[i], 'g', precision, 0, NULL);
1041+
str = PyOS_double_to_string(y[i], 'f', precision, 0, NULL);
10421042
if ((p = __append_to_string(p, buffer, buffersize, str)) == NULL) {
10431043
PyMem_Free(str);
10441044
return 1;

0 commit comments

Comments
 (0)