Skip to content
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

Size unit implementation for PointGeom and TextGeom #215

Merged
merged 17 commits into from
Oct 27, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Modified size_unit example
  • Loading branch information
IKrukov-HORIS committed Oct 22, 2020
commit 8abb82c0dc2bd719f0ad4dc6ed9f081a60227f15
86 changes: 46 additions & 40 deletions docs/examples/jupyter-notebooks-dev/size_unit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{
"data": {
"text/html": [
" <div id=\"e9Yo4Z\"></div>\n",
" <div id=\"tmwE5u\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand Down Expand Up @@ -77,15 +77,15 @@
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"e9Yo4Z\");\n",
" var plotContainer = document.getElementById(\"tmwE5u\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff5a14325d0>"
"<lets_plot.plot.core.PlotSpec at 0x7f68dae5f890>"
]
},
"execution_count": 3,
Expand All @@ -100,13 +100,13 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"vGmgiC\"></div>\n",
" <div id=\"ck4z3O\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand Down Expand Up @@ -134,35 +134,36 @@
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"vGmgiC\");\n",
" var plotContainer = document.getElementById(\"ck4z3O\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff59c0c52d0>"
"<lets_plot.plot.core.PlotSpec at 0x7f68ce721d90>"
]
},
"execution_count": 4,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# as previous, but with size_unit = 'y'\n",
"ggplot(data) + geom_point(aes(x='x', y='y'), size = 2, size_unit='x')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"Hisxa9\"></div>\n",
" <div id=\"ui3plX\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand Down Expand Up @@ -190,35 +191,36 @@
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"Hisxa9\");\n",
" var plotContainer = document.getElementById(\"ui3plX\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff59c0c5790>"
"<lets_plot.plot.core.PlotSpec at 0x7f68ce717350>"
]
},
"execution_count": 5,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# size = 0.4 , size_unit = 'y'\n",
"ggplot(data) + geom_point(aes(x='x', y='y'), size = 0.4, size_unit='y')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"k4Z25K\"></div>\n",
" <div id=\"2QtBWG\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand All @@ -242,7 +244,8 @@
"'mapping':{\n",
"'x':\"x\",\n",
"'y':\"y\",\n",
"'size':\"z\"\n",
"'size':\"z\",\n",
"'color':\"z\"\n",
"},\n",
"'data_meta':{\n",
"},\n",
Expand All @@ -251,36 +254,36 @@
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"k4Z25K\");\n",
" var plotContainer = document.getElementById(\"2QtBWG\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff59c0cee10>"
"<lets_plot.plot.core.PlotSpec at 0x7f68dae5f250>"
]
},
"execution_count": 9,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#with #without\n",
"ggplot(data) + geom_point(aes(x='x', y='y', size='z'), size_unit='x') + scale_size_identity()"
"#with size='z' + scale_size_identity\n",
"ggplot(data) + geom_point(aes(x='x', y='y', size='z', color = 'z'), size_unit='x') + scale_size_identity()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"xrQD2e\"></div>\n",
" <div id=\"ve0Y9y\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand All @@ -300,7 +303,8 @@
"'mapping':{\n",
"'x':\"x\",\n",
"'y':\"y\",\n",
"'size':\"z\"\n",
"'size':\"z\",\n",
"'color':\"z\"\n",
"},\n",
"'data_meta':{\n",
"},\n",
Expand All @@ -309,36 +313,36 @@
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"xrQD2e\");\n",
" var plotContainer = document.getElementById(\"ve0Y9y\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff59c0d77d0>"
"<lets_plot.plot.core.PlotSpec at 0x7f68dae51b90>"
]
},
"execution_count": 11,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#without scale_size_identity\n",
"ggplot(data) + geom_point(aes(x='x', y='y', size='z'), size_unit='x')"
"#as previous example, but without scale_size_identity\n",
"ggplot(data) + geom_point(aes(x='x', y='y', size='z', color='z'), size_unit='x')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"eOwW2l\"></div>\n",
" <div id=\"5J8luD\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand Down Expand Up @@ -368,18 +372,18 @@
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"eOwW2l\");\n",
" var plotContainer = document.getElementById(\"5J8luD\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff59c0d7310>"
"<lets_plot.plot.core.PlotSpec at 0x7f68ce7175d0>"
]
},
"execution_count": 10,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -391,13 +395,13 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"1gNYzA\"></div>\n",
" <div id=\"tLPhrE\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand All @@ -423,28 +427,30 @@
"'size':1,\n",
"'size_unit':\"y\",\n",
"'label_format':\".2f\",\n",
"'angle':90,\n",
"'data':{\n",
"}\n",
"}]\n",
"};\n",
" var plotContainer = document.getElementById(\"1gNYzA\");\n",
" var plotContainer = document.getElementById(\"tLPhrE\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
],
"text/plain": [
"<lets_plot.plot.core.PlotSpec at 0x7ff59c0d7e10>"
"<lets_plot.plot.core.PlotSpec at 0x7f69070c4150>"
]
},
"execution_count": 12,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ggplot(data) + geom_text(aes(x='x', y='y', label='x'), size = 1, size_unit='y', label_format='.2f')"
"# as previous, but size_unit = 'y' + angle = 90\n",
"ggplot(data) + geom_text(aes(x='x', y='y', label='x'), size = 1, size_unit='y', label_format='.2f', angle=90)"
]
},
{
Expand Down