Skip to content

Commit

Permalink
rename Python package, update python code and scripts, update jvm-mav…
Browse files Browse the repository at this point in the history
…en scrips, update readme
  • Loading branch information
alshan committed Nov 25, 2019
1 parent 337a832 commit b498949
Show file tree
Hide file tree
Showing 79 changed files with 473 additions and 497 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ node_modules/
*.egg-info
**/dist
venv
python-package/datalore_plot/package_data
python-package/lets_plot/package_data
__pycache__/
/python-package/*.ipynb

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Datalore-plot changelog
# lets-plot changelog

All notable changes to this project will be documented in this file.

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Datalore Plot
# Lets-Plot

<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Couldn't load MIT license svg"/>
</a>

###
**Datalore Plot** is an open-source plotting library for statistical data. It is implemented using the [Kotlin programming language](https://kotlinlang.org/).
**Lets-Plot** is an open-source plotting library for statistical data. It is implemented using the [Kotlin programming language](https://kotlinlang.org/).

The design of Datalore Plot library is heavily influenced by Leland Wilkinson work [The Grammar of Graphics](https://www.goodreads.com/book/show/2549408.The_Grammar_of_Graphics) describing the deep features that underlie all statistical graphics.
The design of Lets-Plot library is heavily influenced by Leland Wilkinson work [The Grammar of Graphics](https://www.goodreads.com/book/show/2549408.The_Grammar_of_Graphics) describing the deep features that underlie all statistical graphics.

> This grammar [...] is made up of a set of independent components that can be composed in many different ways. This makes [it] very powerful because you are not limited to a set of pre-specified graphics, but you can create new graphics that are precisely tailored for your problem.
> - Hadley Wickham, "ggplot2: [Elegant Graphics for Data Analysis](https://www.goodreads.com/book/show/6829192-ggplot2)"
Expand All @@ -16,6 +16,6 @@ Due to the unique multi-platform nature of Kotlin programming language, you can

### Python Extension

[Learn](README_PYTHON.md) how to create plots in Jupyter using the Datalore Plot python package.
[Learn](README_PYTHON.md) how to create plots in Jupyter using the Lets-Plot python package.

<img src="https://github.com/alshan/jupyter-examples/blob/master/images/quickstart.png" alt="Couldn't load quickstart.png" width="505" height="260"/>
22 changes: 11 additions & 11 deletions README_PYTHON.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Datalore Plot for Python
# Lets-Plot for Python

<table>
<tr>
Expand Down Expand Up @@ -27,32 +27,32 @@

### Implementation Overview

The Datalore Plot python extension includes native backend and a Python API, which was mostly based on the [`ggplot2`](https://ggplot2.tidyverse.org/) package well-known to data scientists who use R.
The Lets-Plot python extension includes native backend and a Python API, which was mostly based on the [`ggplot2`](https://ggplot2.tidyverse.org/) package well-known to data scientists who use R.

R `ggplot2` has extensive documentation and a multitude of examples and therefore is an excellent resource for those who want to learn the grammar of graphics.

Note that the Python API being very similar yet is different in detail from R. Although we have not implemented the entire ggplot2 API in our Python package, we have added a few [new functions](#unfamiliar_functions_used_in_the_examples) and [built-in sampling](#sampling) to our Python API.

You can try the Datalore Plot library in [Datalore](https://blog.jetbrains.com/blog/2018/10/17/datalore-1-0-intelligent-web-application-for-data-analysis/). Datalore Plot is available in Datalore out-of-the-box and is almost identical to the one we ship as PyPI package. This is because Datalore Plot is an offshoot of the Datalore project from which it was extracted to a separate plotting library.
You can try the Lets-Plot library in [Datalore](https://blog.jetbrains.com/blog/2018/10/17/datalore-1-0-intelligent-web-application-for-data-analysis/). Datalore Plot is available in Datalore out-of-the-box and is almost identical to the one we ship as PyPI package. This is because Datalore Plot is an offshoot of the Datalore project from which it was extracted to a separate plotting library.

One important difference is that the python package in Datalore is named **datalore.plot** and the package you install from PyPI has name **datalore_plot**.
One important difference is that the python package in Datalore is named **datalore.plot** and the package you install from PyPI has name **lets_plot**.

The advantage of [Datalore](https://blog.jetbrains.com/blog/2018/10/17/datalore-1-0-intelligent-web-application-for-data-analysis/) as a learning tool in comparison to Jupyter is that it is equipped with very friendly Python editor which comes with auto-completion, intentions, and other useful coding assistance features.


### Installation

To install the Datalore Plot library, run the following command:
To install the Lets-Plot library, run the following command:
```shell script
pip install lets-plot
```

### Quickstart in Jupyter

To evaluate the plotting capabilities of Datalore Plot, add the following code to a Jupyter notebook:
To evaluate the plotting capabilities of Lets-Plot, add the following code to a Jupyter notebook:
```python
import numpy as np
from datalore_plot import *
from lets_plot import *

np.random.seed(12)
data = dict(
Expand All @@ -70,7 +70,7 @@ ggplot(data, aes(x='rating', fill='cond')) + ggsize(500, 250) \

### Examples

Try the following examples to study more features of the Datalore Plot library.
Try the following examples to study more features of the Lets-Plot library.

TBD: replace temporary URLs ---> permanent

Expand Down Expand Up @@ -100,18 +100,18 @@ Various presentation options:
* `ggsize()` - sets size of the plot. Used in many examples starting from `quickstart`
* `geom_density2df()` - fills space between equal density lines on 2D density plot. Similar to `geom_density2d` but supports `fill` aesthetic.

Example: [density_2d.ipynb](https://nbviewer.jupyter.org/github/JetBrains/datalore-plot/blob/master/docs/examples/jupyter-notebooks/density_2d.ipynb)
Example: [density_2d.ipynb](https://nbviewer.jupyter.org/github/JetBrains/lets-plot/blob/master/docs/examples/jupyter-notebooks/density_2d.ipynb)

* `geom_contourf()` - fills space between lines of equal level of bivariate function. Similar to `geom_contour` but supports `fill` aesthetic.

Example: [contours.ipynb](https://nbviewer.jupyter.org/github/JetBrains/datalore-plot/blob/master/docs/examples/jupyter-notebooks/contours.ipynb)
Example: [contours.ipynb](https://nbviewer.jupyter.org/github/JetBrains/lets-plot/blob/master/docs/examples/jupyter-notebooks/contours.ipynb)


### Sampling

Sampling is a special technique of data transformation, which helps dealing with large datasets and overplotting.

[Learn more](docs/sampling_python.md) about sampling in Datalore Plot.
[Learn more](docs/sampling_python.md) about sampling in Lets-Plot.


### License
Expand Down
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
##### 2. Set production version in the properties (remove _"-SNAPSHOT"_ and _"dev"_):

- `version` and `js_artifact_version` in `build.gradle`
- `__version__` in `python-package/datalore_plot/_version.py`
- `__version__` in `python-package/lets_plot/_version.py`

##### 3. Push the version changes and git tag:
Expand All @@ -19,7 +19,7 @@
##### 4. Prepare to the next dev cycle: increment versions and add _"-SNAPSHOT"_ and _"dev"_:

- `version` and `js_artifact_version` in `build.gradle`
- `__version__` in `python-package/datalore_plot/_version.py`
- `__version__` in `python-package/lets_plot/_version.py`

##### 5. Push new dev version to GitHub.

Expand Down
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ allprojects {
// println "--- project ---: $project.name $project.rootDir"
}

def include_sources_datalorePlotJvmCommon = [
def include_sources_letsPlotJvmCommon = [
'base-portable',
'base',
// 'mapper-core',
Expand All @@ -68,7 +68,7 @@ def include_sources_datalorePlotJvmCommon = [
// 'vis-demo-common-jfx',
]

def include_sources_datalorePlotJvmJfx = [
def include_sources_letsPlotJvmJfx = [
'mapper-core',
'vis-svg-mapper',
'vis-svg-mapper-jfx',
Expand All @@ -77,8 +77,8 @@ def include_sources_datalorePlotJvmJfx = [
]

configurations {
datalorePlotJvmCommonSources
datalorePlotJvmJfxSources
letsPlotJvmCommonSources
letsPlotJvmJfxSources
}

subprojects {
Expand All @@ -100,22 +100,22 @@ subprojects {
}

// jar jvm sources of this project
if (name in include_sources_datalorePlotJvmCommon || name in include_sources_datalorePlotJvmJfx) {
if (name in include_sources_letsPlotJvmCommon || name in include_sources_letsPlotJvmJfx) {
apply plugin: 'kotlin-multiplatform'
kotlin.jvm {} // for `jvmSourcesJar` task
build.dependsOn += jvmSourcesJar
}

// make build configuration depend on sources jars
def sources_jar_path = "${buildDir}/libs/${name}-jvm-${version}-sources.jar"
if (name in include_sources_datalorePlotJvmCommon) {
if (name in include_sources_letsPlotJvmCommon) {
rootProject.dependencies {
datalorePlotJvmCommonSources files(sources_jar_path)
letsPlotJvmCommonSources files(sources_jar_path)
}
}
if (name in include_sources_datalorePlotJvmJfx) {
if (name in include_sources_letsPlotJvmJfx) {
rootProject.dependencies {
datalorePlotJvmJfxSources files(sources_jar_path)
letsPlotJvmJfxSources files(sources_jar_path)
}
}
}
Expand Down
46 changes: 23 additions & 23 deletions docs/examples/jupyter-notebooks/contours.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
"\n",
" <div id=\"NGHV64\"></div>\n",
" <script type=\"text/javascript\">\n",
" if(!window.datalorePlotCallQueue) {\n",
" window.datalorePlotCallQueue = [];\n",
" if(!window.letsPlotCallQueue) {\n",
" window.letsPlotCallQueue = [];\n",
" }; \n",
" window.datalorePlotCall = function(f) {\n",
" window.datalorePlotCallQueue.push(f);\n",
" window.letsPlotCall = function(f) {\n",
" window.letsPlotCallQueue.push(f);\n",
" };\n",
" (function() {\n",
" var script = document.createElement(\"script\");\n",
" script.type = \"text/javascript\";\n",
" script.src = \"https://dl.bintray.com/jetbrains/datalore-plot/datalore-plot-0.0.1rc4.min.js\";\n",
" script.onload = function() {\n",
" window.datalorePlotCall = function(f) {f();};\n",
" window.datalorePlotCallQueue.forEach(function(f) {f();});\n",
" window.datalorePlotCallQueue = [];\n",
" window.letsPlotCall = function(f) {f();};\n",
" window.letsPlotCallQueue.forEach(function(f) {f();});\n",
" window.letsPlotCallQueue = [];\n",
" \n",
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkblue';\n",
Expand All @@ -33,8 +33,8 @@
" \n",
" };\n",
" script.onerror = function(event) {\n",
" window.datalorePlotCall = function(f) {}; // noop\n",
" window.datalorePlotCallQueue = [];\n",
" window.letsPlotCall = function(f) {}; // noop\n",
" window.letsPlotCallQueue = [];\n",
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading Datalore Plot JS';\n",
Expand All @@ -53,9 +53,9 @@
],
"source": [
"import numpy as np\n",
"from datalore_plot import *\n",
"from lets_plot import *\n",
"\n",
"load_datalore_plot_js()"
"load_lets_plot_js()"
]
},
{
Expand Down Expand Up @@ -122,15 +122,15 @@
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"plot_output_chjHyJ\");\n",
" window.datalorePlotCall(function() {{\n",
" window.letsPlotCall(function() {{\n",
" DatalorePlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>\n",
" "
],
"text/plain": [
"<datalore_plot.plot.core.PlotSpec at 0x1161cfed0>"
"<lets_plot.plot.core.PlotSpec at 0x1161cfed0>"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -183,15 +183,15 @@
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"plot_output_SK36LD\");\n",
" window.datalorePlotCall(function() {{\n",
" window.letsPlotCall(function() {{\n",
" DatalorePlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>\n",
" "
],
"text/plain": [
"<datalore_plot.plot.core.PlotSpec at 0x105813b10>"
"<lets_plot.plot.core.PlotSpec at 0x105813b10>"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -256,15 +256,15 @@
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"plot_output_BQj8Gs\");\n",
" window.datalorePlotCall(function() {{\n",
" window.letsPlotCall(function() {{\n",
" DatalorePlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>\n",
" "
],
"text/plain": [
"<datalore_plot.plot.core.PlotSpec at 0x1161d78d0>"
"<lets_plot.plot.core.PlotSpec at 0x1161d78d0>"
]
},
"execution_count": 6,
Expand Down Expand Up @@ -335,15 +335,15 @@
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"plot_output_ZlY0P3\");\n",
" window.datalorePlotCall(function() {{\n",
" window.letsPlotCall(function() {{\n",
" DatalorePlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>\n",
" "
],
"text/plain": [
"<datalore_plot.plot.core.PlotSpec at 0x11621de50>"
"<lets_plot.plot.core.PlotSpec at 0x11621de50>"
]
},
"execution_count": 7,
Expand Down Expand Up @@ -400,15 +400,15 @@
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"plot_output_ZUXwIj\");\n",
" window.datalorePlotCall(function() {{\n",
" window.letsPlotCall(function() {{\n",
" DatalorePlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>\n",
" "
],
"text/plain": [
"<datalore_plot.plot.core.PlotSpec at 0x105813490>"
"<lets_plot.plot.core.PlotSpec at 0x105813490>"
]
},
"execution_count": 8,
Expand Down Expand Up @@ -459,15 +459,15 @@
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"plot_output_p2VGQa\");\n",
" window.datalorePlotCall(function() {{\n",
" window.letsPlotCall(function() {{\n",
" DatalorePlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>\n",
" "
],
"text/plain": [
"<datalore_plot.plot.core.PlotSpec at 0x11621de10>"
"<lets_plot.plot.core.PlotSpec at 0x11621de10>"
]
},
"execution_count": 9,
Expand Down
Loading

0 comments on commit b498949

Please sign in to comment.