{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Publish a visualization of a layout\n", "\n", "This example illustrates how to publish a layout of map visualizations.\n", "\n", ">_Note: You'll need your [CARTO Account](https://carto.com/signup) credentials to reproduce this example._" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from cartoframes.auth import set_default_credentials\n", "from cartoframes.viz import Map, Layer, Layout, basic_style, color_category_style\n", "\n", "set_default_credentials('creds.json')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": false }, "outputs": [], "source": [ "layout_viz = Layout([\n", " Map(Layer('public_table')),\n", " Map(Layer('private_table'))\n", "])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The map has been published. The \"cartoframes_997c05771fd4e0916de49826722e51cd\" Maps API key with value \"7rj9ftFsOKUjSotnygh2jg\" is being used for the datasets: \"private_table\". You can manage your API keys on your account.\n" ] }, { "data": { "text/plain": [ "{'id': '70057fe9-57ad-4e3c-999f-a086c2a1d494',\n", " 'url': 'https://cartoframes-org.carto.com/u/cartoframes/kuviz/70057fe9-57ad-4e3c-999f-a086c2a1d494',\n", " 'name': 'layout_public_private_table',\n", " 'privacy': 'password'}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "layout_viz.publish(\n", " 'layout_public_private_table',\n", " password='1234',\n", " if_exists='replace')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }