You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by moon soo Lee <mo...@apache.org> on 2015/09/02 08:02:48 UTC

Re: Zeppelin Charts - Axis Labels, Autoscale axis etc

Hi,

Currently, i think built-in chart doesn't meet your requirement.

You can either render your own chart using javascript and html,
Or you can use matplotlib of pyspark to draw something, for example

%pyspark
# helper function to display in Zeppelin

import StringIO
def show(p):
  img = StringIO.StringIO()
  p.savefig(img, format='svg')
  img.seek(0)
  print "%html " + img.buf

%pyspark
import matplotlib.pyplot as plt

#define some data
x = [1,2,3,4]
y = [20, 21, 20.5, 20.8]

#plot data
plt.plot(x, y, linestyle="dashed", marker="o", color="green")
%pyspark
show(plt)

You can exchange data between scala and python using z.get()/z.put()

Thanks,
moon

On Tue, Aug 25, 2015 at 12:20 PM hasan türken <tu...@gmail.com> wrote:

> Hi,
>
> I am trying to use Zeppelin Charts to visualize some data.
> But I could not find a way to put some labels on axis. Also I have a data
> whose value goes between lets say, 30.2 to 30.8 on Y-Axis. Unfortunately,
> Y-Axis starts from 0 and thus I can only see a straight line which is not
> expected.
>
> So my questions are:
>
> - Can we put some labels on axises?
> - Can we define some min-max values for axises, or is it possible to force
> to auto scale somehow?
>
> Thanks in Advance,
> Hasan
>

Re: Zeppelin Charts - Axis Labels, Autoscale axis etc

Posted by madhuka udantha <ma...@gmail.com>.
Hi, Hasan

Yes as moon has explained, current zeppelin built-in chart doesn't meet
your requirement.

But just have look on 'setD3Chart()' function[1] in paragraph.controller.js
In there you can find how this axis and chart is handle in zeppelin. You
can introduce this feature for zeppelin even if you are interested.

[1]
https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js#L839

On Wed, Sep 2, 2015 at 11:32 AM, moon soo Lee <mo...@apache.org> wrote:

> Hi,
>
> Currently, i think built-in chart doesn't meet your requirement.
>
> You can either render your own chart using javascript and html,
> Or you can use matplotlib of pyspark to draw something, for example
>
> %pyspark
> # helper function to display in Zeppelin
>
> import StringIO
> def show(p):
>   img = StringIO.StringIO()
>   p.savefig(img, format='svg')
>   img.seek(0)
>   print "%html " + img.buf
>
> %pyspark
> import matplotlib.pyplot as plt
>
> #define some data
> x = [1,2,3,4]
> y = [20, 21, 20.5, 20.8]
>
> #plot data
> plt.plot(x, y, linestyle="dashed", marker="o", color="green")
> %pyspark
> show(plt)
>
> You can exchange data between scala and python using z.get()/z.put()
>
> Thanks,
> moon
>
> On Tue, Aug 25, 2015 at 12:20 PM hasan türken <tu...@gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to use Zeppelin Charts to visualize some data.
>> But I could not find a way to put some labels on axis. Also I have a data
>> whose value goes between lets say, 30.2 to 30.8 on Y-Axis. Unfortunately,
>> Y-Axis starts from 0 and thus I can only see a straight line which is not
>> expected.
>>
>> So my questions are:
>>
>> - Can we put some labels on axises?
>> - Can we define some min-max values for axises, or is it possible to
>> force to auto scale somehow?
>>
>> Thanks in Advance,
>> Hasan
>>
>


-- 
Cheers,
Madhuka Udantha
http://madhukaudantha.blogspot.com