Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: "maven"
apply plugin: "signing"

group 'com.github.sh0nk'
version '0.4.1-SNAPSHOT'
version '0.5.0-SNAPSHOT'
archivesBaseName = "matplotlib4j"
description = "Matplotlib for java: A simple graph plot library for java with powerful python matplotlib"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Sep 24 01:25:45 JST 2017
#Wed Oct 23 10:40:47 UTC 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-all.zip
zipStoreBase=GRADLE_USER_HOME
6 changes: 3 additions & 3 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main/java/com/github/sh0nk/matplotlib4j/PyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.slf4j.LoggerFactory;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.List;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -88,7 +89,7 @@ private void command(List<String> commands) throws IOException, PythonExecutionE
}

private void writeFile(String pythonScript, File script) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(script)));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(script), StandardCharsets.UTF_8));
bw.write(pythonScript);
bw.close();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.sh0nk.matplotlib4j;

import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

public enum TypeConversion {
Expand All @@ -17,4 +18,8 @@ public List<Object> typeSafeList(List<? extends Number> orgList) {
}
}).collect(Collectors.toList());
}

public String toSafeDouble(double d) {
return String.format(Locale.US, "%.6f", d);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.sh0nk.matplotlib4j.builder;

import com.github.sh0nk.matplotlib4j.TypeConversion;
import com.github.sh0nk.matplotlib4j.kwargs.PatchBuilder;
import com.github.sh0nk.matplotlib4j.kwargs.PatchBuilderImpl;
import com.google.common.base.Joiner;
Expand Down Expand Up @@ -33,7 +34,8 @@ public HistBuilder bins(List<? extends Number> nums) {

@Override
public HistBuilder range(double lower, double upper) {
return innerBuilder.addToKwargsWithoutQuoting("range", String.format("(%f, %f)", lower, upper));
return innerBuilder.addToKwargsWithoutQuoting("range", String.format("(%s, %s)",
TypeConversion.INSTANCE.toSafeDouble(lower), TypeConversion.INSTANCE.toSafeDouble(upper)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.github.sh0nk.matplotlib4j.builder;

import com.github.sh0nk.matplotlib4j.TypeConversion;

public class LegendBuilderImpl implements LegendBuilder {

private CompositeBuilder<LegendBuilder> innerBuilder = new CompositeBuilder<>(this);
Expand All @@ -16,7 +18,8 @@ public LegendBuilder loc(String arg) {

@Override
public LegendBuilder loc(double x, double y) {
return innerBuilder.addToKwargsWithoutQuoting("loc", String.format("(%d, %d)", x, y));
return innerBuilder.addToKwargsWithoutQuoting("loc", String.format("(%s, %s)",
TypeConversion.INSTANCE.toSafeDouble(x), TypeConversion.INSTANCE.toSafeDouble(y)));
}

@Override
Expand Down