{"action":"created","issue":{"url":"https://api.github.com/repos/enthought/chaco/issues/288","repository_url":"https://api.github.com/repos/enthought/chaco","labels_url":"https://api.github.com/repos/enthought/chaco/issues/288/labels{/name}","comments_url":"https://api.github.com/repos/enthought/chaco/issues/288/comments","events_url":"https://api.github.com/repos/enthought/chaco/issues/288/events","html_url":"https://github.com/enthought/chaco/pull/288","id":129938624,"number":288,"title":"Added MinorPlotAxis","user":{"login":"stevenengler","id":3708797,"avatar_url":"https://avatars.githubusercontent.com/u/3708797?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenengler","html_url":"https://github.com/stevenengler","followers_url":"https://api.github.com/users/stevenengler/followers","following_url":"https://api.github.com/users/stevenengler/following{/other_user}","gists_url":"https://api.github.com/users/stevenengler/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenengler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenengler/subscriptions","organizations_url":"https://api.github.com/users/stevenengler/orgs","repos_url":"https://api.github.com/users/stevenengler/repos","events_url":"https://api.github.com/users/stevenengler/events{/privacy}","received_events_url":"https://api.github.com/users/stevenengler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-30T04:33:22Z","updated_at":"2016-03-08T02:53:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/enthought/chaco/pulls/288","html_url":"https://github.com/enthought/chaco/pull/288","diff_url":"https://github.com/enthought/chaco/pull/288.diff","patch_url":"https://github.com/enthought/chaco/pull/288.patch"},"body":"Added `MinorPlotAxis`, which is a `PlotAxis` with smaller ticks, smaller interval, and no tick labels. This should not break anything, the only change was to `auto_interval()`, which I added an optional argument to.\r\n\r\nThis originated from the stackoverflow question here:\r\nhttps://stackoverflow.com/questions/34755769/minor-ticks-in-chaco-plot/34833938#34833938\r\n\r\n![image](https://cloud.githubusercontent.com/assets/3708797/12693513/c9fb204c-c6d9-11e5-8190-a87adb3b5fa3.png)\r\n\r\n```python\r\nif __name__ == \"__main__\":\r\n\tfrom traits.etsconfig.api import ETSConfig\r\n\tETSConfig.toolkit = 'qt4'\r\n\t#\r\n\timport warnings\r\n\twarnings.filterwarnings(action = \"ignore\", category = FutureWarning, module=\"chaco\")\r\n\twarnings.filterwarnings(action = \"ignore\", category = FutureWarning, module=\"traits\")\r\n#\r\nfrom PySide import QtGui, QtCore\r\nimport numpy as np\r\nfrom enable.api import Component, Container, Window\r\nfrom chaco.api import *\r\nimport sys\r\n#\r\nclass ChacoPlot(QtGui.QWidget):\r\n\tdef __init__(self, parent=None):\r\n\t\tsuper(ChacoPlot, self).__init__(parent)\r\n\t\t#\r\n\t\tself.container = OverlayPlotContainer(padding=40)\r\n\t\t#\r\n\t\tself.enableWindow = Window(self, -1, component=self.container)\r\n\t\twindowLayout = QtGui.QVBoxLayout(self)\r\n\t\twindowLayout.addWidget(self.enableWindow.control)\r\n\t\t#\r\n\t\tself.xRange = DataRange1D()\r\n\t\tself.yRange = DataRange1D()\r\n\t\t#\r\n\t\tself.xMapper = LinearMapper(range=self.xRange)\r\n\t\tself.yMapper = LinearMapper(range=self.yRange)\r\n\t\t#\r\n\t\tself.plots = {}\r\n\t\t# keep a list of plots added to the container\r\n\t#\r\n\tdef setMinimumSize(self, width, height):\r\n\t\tself.enableWindow.control.setMinimumSize(width, height)\r\n\t#\r\n\tdef addLine(self, name, plotType):\r\n\t\txSource = ArrayDataSource([0])\r\n\t\tySource = ArrayDataSource([0])\r\n\t\t#\r\n\t\tself.xRange.add(xSource)\r\n\t\tself.yRange.add(ySource)\r\n\t\t#\r\n\t\tindex_mapper = self.xMapper\r\n\t\tvalue_mapper = self.yMapper\r\n\t\t#\r\n\t\t# plotType is a class name\r\n\t\tplot = plotType(\tindex = xSource,\r\n\t\t\t\t\t\t\tvalue = ySource,\r\n\t\t\t\t\t\t\tindex_mapper = index_mapper,\r\n\t\t\t\t\t\t\tvalue_mapper = value_mapper,\r\n\t\t\t\t\t\t\tvisible = False\r\n\t\t\t\t\t   )\r\n\t\t#\r\n\t\tself.container.add(plot)\r\n\t\t#\r\n\t\tself.plots[name] = {'plot':plot, 'xSource':xSource, 'ySource':ySource}\r\n\t#\r\n\tdef updateLine(self, name, xData, yData):\r\n\t\tplot = self.plots[name]\r\n\t\t#\r\n\t\tif np.array(xData).size != 0:\r\n\t\t\tplot['plot'].visible = True\r\n\t\telse:\r\n\t\t\tplot['plot'].visible = False\r\n\t\t\txData = [0]\r\n\t\t\tyData = [0]\r\n\t\t#\r\n\t\tplot['xSource'].set_data(xData)\r\n\t\tplot['ySource'].set_data(yData)\r\n\t#\r\n\tdef addAxis(self, plotName, orientation):\r\n\t\tplot = self.plots[plotName]['plot']\r\n\t\t#\r\n\t\tif orientation == 'top' or orientation == 'bottom':\r\n\t\t\tmapper = self.xMapper\r\n\t\tif orientation == 'left' or orientation == 'right':\r\n\t\t\tmapper = self.yMapper\r\n\t\t#\r\n\t\taxis = PlotAxis(plot, orientation=orientation, mapper=mapper)\r\n\t\tplot.overlays.append(axis)\r\n\t\t#\r\n\t\treturn axis\r\n\t#\r\n\tdef addMinorAxis(self, plotName, orientation):\r\n\t\tplot = self.plots[plotName]['plot']\r\n\t\t#\r\n\t\tif orientation == 'top' or orientation == 'bottom':\r\n\t\t\tmapper = self.xMapper\r\n\t\t\trange = self.xRange\r\n\t\tif orientation == 'left' or orientation == 'right':\r\n\t\t\tmapper = self.yMapper\r\n\t\t\trange = self.yRange\r\n\t\t#\r\n\t\tnewAxis = MinorPlotAxis(plot, orientation=orientation, mapper=mapper)\r\n\t\tplot.overlays.append(newAxis)\r\n\t\t#\r\n\t\treturn axis\r\n\t#\r\n#\r\nif __name__ == \"__main__\":\r\n\tappQT = QtGui.QApplication.instance()\r\n\t#\r\n\tx1 = np.arange(300)/18.0\r\n\ty1 = np.sin(x1)\r\n\tx2 = np.arange(300)/18.0\r\n\ty2 = 2.0*np.cos(x2)\r\n\t#\r\n\tplot = ChacoPlot()\r\n\tplot.setMinimumSize(400,300)\r\n\t#\r\n\tplot.addLine('line1', LinePlot)\r\n\tplot.addLine('line2', LinePlot)\r\n\tplot.updateLine('line1', x1, y1)\r\n\tplot.updateLine('line2', x2, y2)\r\n\t#\r\n\tplot.addAxis('line1', 'bottom')\r\n\tplot.addAxis('line1', 'left')\r\n\tplot.addMinorAxis('line1', 'bottom')\r\n\tplot.addMinorAxis('line1', 'left')\r\n\t#\r\n\tplot.show()\r\n\tappQT.exec_()\r\n```"},"comment":{"url":"https://api.github.com/repos/enthought/chaco/issues/comments/193575060","html_url":"https://github.com/enthought/chaco/pull/288#issuecomment-193575060","issue_url":"https://api.github.com/repos/enthought/chaco/issues/288","id":193575060,"user":{"login":"stevenengler","id":3708797,"avatar_url":"https://avatars.githubusercontent.com/u/3708797?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenengler","html_url":"https://github.com/stevenengler","followers_url":"https://api.github.com/users/stevenengler/followers","following_url":"https://api.github.com/users/stevenengler/following{/other_user}","gists_url":"https://api.github.com/users/stevenengler/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenengler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenengler/subscriptions","organizations_url":"https://api.github.com/users/stevenengler/orgs","repos_url":"https://api.github.com/users/stevenengler/repos","events_url":"https://api.github.com/users/stevenengler/events{/privacy}","received_events_url":"https://api.github.com/users/stevenengler/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T02:53:52Z","updated_at":"2016-03-08T02:53:52Z","body":"Thanks for the unit tests @timdiller. I added a couple more simple tests for the `MinorTickGenerator`, feel free to make any changes or let me know. I will add to the documentation within the next few days."}}