Abstract Narrow emission-line galaxies can be distinguished in the well-known BPT diagrams through narrow emission-line properties. However, there are no boundaries visible to the naked eye between type-2 active galactic nuclei (AGN) and H ii galaxies in BPT diagrams, besides the extreme dividing lines expected by theoretical photoionization models. Here, based on the powerful t-SNE technique applied to the local narrow emission-line galaxies in the Sloan Digital Sky Survey Data Release 15, type-2 AGN and H ii galaxies can be clearly separated in the t-SNE determined two-dimensional projected map, and then the dividing lines can be mathematically determined in BPT diagrams, leading to charming harmonization of the theoretical expectations and the actual results from real observed properties. The results not only provide an interesting and robust method to determine the dividing lines in BPT diagrams through the powerful t-SNE technique, but also lead to further confirmation on previously defined composite galaxies more efficiently classified in the BPT diagram of [O iii]/Hβ versus [N ii]/Hα.