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

y-axis extends beyond zero with no points below zero. #34

Open
GregorySchwartz opened this issue Jul 27, 2017 · 1 comment
Open

y-axis extends beyond zero with no points below zero. #34

GregorySchwartz opened this issue Jul 27, 2017 · 1 comment

Comments

@GregorySchwartz
Copy link

In the line plot example: if I just add one point at the y-axis of 0 (mydata3 point 2), no data point goes below 0 yet the y-axis extends beyond 0 and looks unpleasant. I would expect this plot's axis to begin at 0 for both the x- and y-axis. However, I do not recommend cutting it at the lowest or highest datapoint automatically at all, I think it should be a special case for 0 in the x- and y-axis.

{-# LANGUAGE FlexibleContexts #-}

import Plots
import Diagrams.Prelude
import Plots.Axis.Line

import Data.Typeable

mydata1 = [(1,3), (2,5.5), (3.2, 6), (3.5, 6.1)]
mydata2 = mydata1 & each . _1 *~ 0.5
mydata3 = [V2 1.2 2.7, V2 1.7 0, V2 2 5.1, V2 3.2 2.6, V2 3.5 5]

myaxis :: Axis B V2 Double
myaxis = r2Axis &~ do
  linePlot' mydata1
  linePlot mydata2 $ do
    key "data 2"
    plotColor .= black

  linePlot mydata3 $ key "data 3"

  hideGridLines
  xAxis . axisLineType .= MiddleAxisLine
  yAxis . axisLineType .= LeftAxisLine

  lineStyle . _lineCap .= LineCapSquare
  lineStyle . _lineJoin .= LineJoinBevel

dia = renderAxis myaxis
@cchalmers
Copy link
Owner

This is interesting suggestion. I'm not happy with the current way the bounds and ticks etc. are done done currently and I want to have an overhaul. When I do I'll consider this. (It will be a while until I get round to doing it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants