python-ecology-lesson icon indicating copy to clipboard operation
python-ecology-lesson copied to clipboard

04 Join Images

Open tmorrell opened this issue 6 years ago • 18 comments

The join images from coding horror don't load inline in episode 04 on browsers that use an ad blocker like privacy badger. These could be recreated so they could be stored locally in the fig directory.

tmorrell avatar Apr 25 '18 19:04 tmorrell

It seems worse to me. Even with just wget I cannot get the linked images (it fails due to too many redirections):

$ wget http://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
--2018-05-09 08:52:52--  http://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Resolving blog.codinghorror.com (blog.codinghorror.com)... 104.27.51.35, 104.27.50.35, 2400:cb00:2048:1::681b:3223, ...
Connecting to blog.codinghorror.com (blog.codinghorror.com)|104.27.51.35|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Loaded CA certificate '/home/rhaas/.cacert.pem'
Connecting to blog.codinghorror.com (blog.codinghorror.com)|104.27.51.35|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:52--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
--2018-05-09 08:52:53--  https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png
Reusing existing connection to blog.codinghorror.com:443.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://blog.codinghorror.com/content/images/uploads/2007/10/6a0120a85dcdae970b012877702708970c-pi.png [following]
20 redirections exceeded.

rhaas80 avatar May 09 '18 13:05 rhaas80

Good suggestion. Lessons should be independent of outside resources. A PR that moves images under the dome of this repository would be welcome.

maxim-belkin avatar May 09 '18 14:05 maxim-belkin

I added a couple figure drafts (inner-join, left-join and right-join) to the figs/ directory. Could someone put eyes on them? I uploaded them to a colorblind simulator, and they seem fine, but I'm not sure I love the way I've labeled them.

wrightaprilm avatar May 09 '18 15:05 wrightaprilm

The colors are great, and I think they make the contributions from the two tables clearer than the existing images.

tmorrell avatar May 09 '18 20:05 tmorrell

I also think the colours are great and I like the idea to use two different colours for the 2 tables. I am just wondering about the different filling of the circles - to make the picture of the inner join consistent with the left/right join pics, should rather only the intersection be filled with the mixed colour and the rest of both circles white? And when using mixed colour for the intersection, should that not also appear in the left and right join pics, and only the non intersecting part be filled with the original colour?

katrintirok avatar May 10 '18 09:05 katrintirok

I added a couple figure drafts

@wrightaprilm, It would've been better to either upload figures to your fork or drag and drop them here.

maxim-belkin avatar May 10 '18 10:05 maxim-belkin

Katrin- More like?

untitled 001 untitled 002 untitled 003

wrightaprilm avatar May 10 '18 13:05 wrightaprilm

I'd suggest using SVG for images like that: https://stackoverflow.com/questions/47632870/fill-intersection-of-two-circles

maxim-belkin avatar May 10 '18 13:05 maxim-belkin

Looks very cool now.

Regarding the svg - we had previously issues with rendering svg's in different browsers (the slicing figures), otherwise I agree that drawings would be better as svg.

katrintirok avatar May 10 '18 13:05 katrintirok

I am willing to help with the svg part (or, I'm sure @rhaas80 can help too) once you guys decide on the colors, text, etc.

maxim-belkin avatar May 10 '18 13:05 maxim-belkin

I don't feel strongly on the format of the images, and various repos do whatever they want, and this issue isn't in the handbook. I used png because Keynote exports to it, and the rest of our images are png, and that was how I knew how to make a figure like this ;P. I think Katrin makes a good point about the only .svg figure set we've recently had render issues. I'm open to the argument, but I'm not informed enough about the +/- of different formats.

I'd like to get them settled quickly, since this is inhibiting the lessons from compiling correctly for anyone who might be using them. If people could thumbs-up this post when satisfied, that'd be great; other suggestions can go below.

wrightaprilm avatar May 10 '18 13:05 wrightaprilm

svg is vector graphics file format so it scales up and down without any loss of detail png is raster graphics file format

With regards to the rendering issues: SVG in general should be widely supported: http://svgtutorial.com/svg-browser-support/

Here is the first image in svg: format

<svg width="300" height="220" xmlns="http://www.w3.org/2000/svg">
    <defs>
        <clipPath id="mask_left">
            <circle r="85" id="circle_right" cy="100" cx="200" stroke-width="1.5"  stroke="#000" fill="none"/>
        </clipPath>
    </defs>
    <g>
        <circle r="85" id="center" cy="100" cx="100" fill="#9da8f0" clip-path="url(#mask_left)"/>
        <circle r="85" id="circle_left" cy="100" cx="100" stroke-width="1.5" stroke="#419ef4" fill="none" />
        <circle r="85" id="circle_right" cy="100" cx="200" stroke-width="1.5"  stroke="#f4a4c4" fill="none"/>
        <text x="124" y="106" font-family="sans-serif" font-size="12" fill="#000">Inner Join</text>
        <text x="70"  y="210" font-family="sans-serif" font-size="12" fill="#000">Table One</text>
        <text x="180" y="210" font-family="sans-serif" font-size="12" fill="#000">Table Two</text>
    </g>
</svg>

maxim-belkin avatar May 10 '18 14:05 maxim-belkin

@maxim-belkin seems to have the figure under control. Yes, I could help making the figure if there is need (though not by hand-crafting svg code, I do not understand anywhere near enough of svg to do that). Given @katrintirok's comment about svg figures (independent of whether browsers should support it it or not according to the table) it may be useful to use png for the actual delivered images. Having svg around however makes it much more easy to edit the figure (or eg to make a version of it in a different language) since svg lets one edit text as text. I have no experience how this is usually handled though (ie is it fine / common to have a "source" version in the repo along with a "auto-generated" one).

rhaas80 avatar May 10 '18 15:05 rhaas80

I have 10 minutes more experience with SVG than you :)

maxim-belkin avatar May 10 '18 15:05 maxim-belkin

@wrightaprilm, do you think you'll have the time to look into SVG thing? Or do you want to proceed with PNG and then we transition to SVG separately?

maxim-belkin avatar May 10 '18 16:05 maxim-belkin

Good question. I think the thing to do might be to merge in the pngs for now, since there's time-sensitivity. Then we can kick the question of a unified image format to the maintainers at the monthly maintainers meeting, since a best practice on image workflows will affect more than just us and it's probably good to get that hammered out from an organizational perspective.

Does that sound OK?

wrightaprilm avatar May 10 '18 16:05 wrightaprilm

Does that sound OK?

yep

maxim-belkin avatar May 10 '18 16:05 maxim-belkin

OK, I'll go ahead and add my figures from my comment three hours ago and update the markdown with the links. I'm going to leave the issue open and tag the issue as a 'wait', pending discussion with the other maintainers.

wrightaprilm avatar May 10 '18 16:05 wrightaprilm

Images were merged.

btovar avatar May 15 '23 14:05 btovar