Repository: sunpy/sunpy

Issue:
example on using ticks and grids added
This PR is continuation of #2372.The necessary changes mentioned in the comments on that PR  are modified here.


Discussion:
Hello @rajasekharmekala! Thanks for updating the PR.



 - In the file [`sunpy/instr/goes.py`](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py), following are the PEP8 issues :

> [Line 44:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L44): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (133 > 100 characters)
> [Line 122:31](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L122): [E128](https://duckduckgo.com/?q=pep8%20E128) continuation line under-indented for visual indent
> [Line 123:31](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L123): [E128](https://duckduckgo.com/?q=pep8%20E128) continuation line under-indented for visual indent
> [Line 124:31](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L124): [E128](https://duckduckgo.com/?q=pep8%20E128) continuation line under-indented for visual indent
> [Line 127:31](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L127): [E128](https://duckduckgo.com/?q=pep8%20E128) continuation line under-indented for visual indent
> [Line 128:31](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L128): [E128](https://duckduckgo.com/?q=pep8%20E128) continuation line under-indented for visual indent
> [Line 977:5](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/goes.py#L977): [E122](https://duckduckgo.com/?q=pep8%20E122) continuation line missing indentation or outdented

 - In the file [`sunpy/instr/rhessi.py`](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/rhessi.py), following are the PEP8 issues :

> [Line 89:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/rhessi.py#L89): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (101 > 100 characters)
> [Line 132:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/rhessi.py#L132): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (101 > 100 characters)
> [Line 210:5](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/rhessi.py#L210): [E303](https://duckduckgo.com/?q=pep8%20E303) too many blank lines (2)
> [Line 356:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/instr/rhessi.py#L356): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (122 > 100 characters)





 - In the file [`sunpy/map/mapbase.py`](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py), following are the PEP8 issues :

> [Line 229:1](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L229): [E122](https://duckduckgo.com/?q=pep8%20E122) continuation line missing indentation or outdented
> [Line 787:13](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L787): [E129](https://duckduckgo.com/?q=pep8%20E129) visually indented line with same indent as next logical line
> [Line 821:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L821): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (101 > 100 characters)
> [Line 1111:67](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1111): [E128](https://duckduckgo.com/?q=pep8%20E128) continuation line under-indented for visual indent
> [Line 1262:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1262): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (103 > 100 characters)
> [Line 1297:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1297): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (119 > 100 characters)
> [Line 1366:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1366): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (138 > 100 characters)
> [Line 1409:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1409): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (128 > 100 characters)
> [Line 1410:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1410): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (128 > 100 characters)
> [Line 1451:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1451): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (121 > 100 characters)
> [Line 1702:5](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapbase.py#L1702): [E129](https://duckduckgo.com/?q=pep8%20E129) visually indented line with same indent as next logical line

 - In the file [`sunpy/map/mapcube.py`](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapcube.py), following are the PEP8 issues :

> [Line 3:1](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapcube.py#L3): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '
> [Line 53:5](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapcube.py#L53): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '
> [Line 171:13](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapcube.py#L171): [E731](https://duckduckgo.com/?q=pep8%20E731) do not assign a lambda expression, use a def
> [Line 333:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/map/mapcube.py#L333): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (110 > 100 characters)

 - In the file [`sunpy/net/dataretriever/tests/test_eve.py`](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py), following are the PEP8 issues :

> [Line 24:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py#L24): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (116 > 100 characters)
> [Line 25:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py#L25): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (115 > 100 characters)
> [Line 28:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py#L28): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (116 > 100 characters)
> [Line 29:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py#L29): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (116 > 100 characters)
> [Line 32:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py#L32): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (116 > 100 characters)
> [Line 33:101](https://github.com/sunpy/sunpy/blob/1ba8561b80f57c0765f07d8a4018fb42d38ab63c/sunpy/net/dataretriever/tests/test_eve.py#L33): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (116 > 100 characters)







##### Comment last updated on January 25, 2018 at 19:54 Hours UTC
Does this mean I can close the other PR? 
Can you create the example and embed the output here please?
![figure_1](https://user-images.githubusercontent.com/13769685/35268123-4bc3a478-004e-11e8-9f04-46057d8825d1.png)

Thanks! Looks like the title didn't render right. 
![figure_1](https://user-images.githubusercontent.com/13769685/35270007-c05e6200-0053-11e8-8bbc-a292f4089931.png)
Title corrected
Also why are the numbers on the colorbar cut off? 
Have no idea.It works fine in python notebook.i think it's a problem with my libraries.It works fine in other systems
![fig2](https://user-images.githubusercontent.com/13769685/35275948-7658d7da-0067-11e8-8d37-53ec43873dfd.png)
jupyter Notebook  image

and i do not understand why travis-ci is failing
That looks better, well if it's just an issue with where you are running it, it should come out fine in the gallery. 

Which one is failing? 
![doc](https://user-images.githubusercontent.com/13769685/35335722-5ae23e76-013c-11e8-93a7-ae3cbc520954.png)

regarding the single line comments, i tried building with sphinx and the page looks as above and shows the comments
If those comments are important they should be rendered in the html instead of in the python code block.
I don't think they need to be in the HTML.  They just need to be somewhere
to tell the user what particular lines are doing. Something like what
scikit-learn does

http://scikit-learn.org/stable/auto_examples/plot_johnson_lindenstrauss_bound.html#sphx-glr-auto-examples-plot-johnson-lindenstrauss-bound-py

On Wed, Jan 24, 2018 at 9:05 AM, Nabil Freij <notifications@github.com>
wrote:

> If those comments are important they should be rendered in the html
> instead of in the python code block.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/sunpy/sunpy/pull/2421#issuecomment-360145726>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AA8CF-_ELX32NagNAI9fTYlqBecR2QTvks5tNzi0gaJpZM4RpC8p>
> .
>

@wafels travis-ci fails for python3.6 for files which i did not edit and I do not know why..
That's due to a known problem, you can ignore that one. 
I'd remove the word "sensitive" from "sensitive control".
@nabobalis please suggest if any more changes are required
It looks fine to me.
Why did you revert that commit?
@nabobalis  sorry.I was trying to fetch the new commits to my forked repository.How should i undo it?
Maybe try reverting the unrevert commit
@nabobalis after you have approved the changes, i tried  fetch upstream from master.Then a commit occured.So i tried to revert it back.
Next time, you want to create work on branch from your fork instead of master. 

I think the only way now would be to rebase off upstream/master and delete the commits.
@nabobalis is this acceptible?I think probably i should add a new PR..
Yeah, this isn't right. You seem to have added more commits and not deleted the revert commit. 

Not sure what to do about it without trying myself. 

Resolving patch:
diff --git a/examples/finegrained_plot.py b/examples/finegrained_plot.py
new file mode 100644
--- /dev/null
+++ b/examples/finegrained_plot.py
@@ -0,0 +1,75 @@
+"""
+===============================
+Fine grained Plotting Features
+===============================
+
+An example to show control over various plotting features.
+"""
+###############################################################################
+# Import the necessary modules for plotting.
+
+import astropy.units as u
+from astropy.coordinates import SkyCoord
+import matplotlib.pyplot as plt
+from matplotlib.colors import LogNorm
+
+import sunpy.map
+from sunpy.data.sample import AIA_171_IMAGE
+
+
+###############################################################################
+# SkyCoord module provides flexible celestial coordinate representation and a
+# draw_limb method draws an edge as seen against the dark sky background. Date of the
+# image taken can also be displayed in the plot.
+aiamap = sunpy.map.Map(AIA_171_IMAGE)
+
+bottom_left = SkyCoord(-400*u.arcsec, -900*u.arcsec, frame=aiamap.coordinate_frame)
+top_right = SkyCoord(800*u.arcsec, 700*u.arcsec, frame=aiamap.coordinate_frame)
+aiamap_sub = aiamap.submap(bottom_left, top_right)
+
+title_obsdate = '{:%Y-%b-%d %H:%M:%S}'.format(aiamap_sub.date)
+
+###############################################################################
+# The SunPy map peek method shows a helioprojective  grid by default.
+# This is sometimes not desired, and instead a heliographic Stonyhurst grid might
+# be required. Although maps offer a simple way to include a Stonyhurst grid, often
+# times we want more control over the Stonyhurst type. The example below illustrates
+# some aspects of how a map plot can be altered as desired. For more information
+# regarding the axis and grid settings, go to `Ticks, tick labels and grid lines
+# <http://docs.astropy.org/en/stable/visualization/wcsaxes/ticks_labels_grid.html>`_ in astropy.
+
+fig = plt.figure(figsize=(6, 6))
+ax = plt.subplot(projection=aiamap_sub)
+aiamap_sub.plot()
+aiamap_sub.draw_limb(color='white', linewidth=2, linestyle='dashed')
+
+# To have more control over the Heliographic Stonyhurst grid,
+# the axes object properties can be changed directly
+
+overlay = ax.get_coords_overlay('heliographic_stonyhurst')
+lon = overlay[0]
+lat = overlay[1]
+
+lon.set_ticks_visible(False)
+lat.set_ticks_visible(False)
+lat.set_ticklabel_visible(False)
+lon.set_ticklabel_visible(False)
+
+lon.coord_wrap = 180
+lon.set_major_formatter('dd')
+
+# Plot the Heliographic Stonyhurst grid
+overlay.grid(color='blue', linewidth=2, linestyle='dashed')
+# Switch off the helioprojective grid
+ax.grid(False)
+
+# Change how the helioprojective grid tick labels are formatted
+tx, ty = ax.coords
+# Use integer coordinates for either axis.
+tx.set_major_formatter('s')
+ty.set_major_formatter('s')
+ax.set_title('AIA 171 $\AA$ {}'.format(title_obsdate))
+ax.set_ylabel('Helioprojective Latitude [arcsec]')
+ax.set_xlabel('Helioprojective Longitude [arcsec]')
+plt.colorbar(fraction=0.045, pad=0.03, label='DN', ax=ax)
+plt.show()


Test patch: